Sometimes I need to block access on a website, but I don’t want to block access for administrators so they should be able to see the website and for that I guess I need to make a module.
How can I make a module like that?
This is the code I have. I just don’t know where I should place it.
var user = Membership.GetUser() as User;
if (user == null || (user != null && !user.IsAdministrator))
{
// Block
}
You can block access to a site, or portions of a site, using web.config files to configure your directories.
As an example,
EDIT: Based on your comments above, you might be interested in the technique described at the bottom of this article for taking an application offline but still allowing administration access.
See the docs on the location element for more examples and information.