Hi,
New to C# programming.
I'm trying to implement some simple security in my website.
Basically a user cannot surf to secured aspx pages simply by accessing them
directly through the address bar. If they have not logged in and created a
forms authentication cookie they will be redirected to a friendly page
telling them the page is inaccessible.
I'm putting my code: (in the global.ascx.cs file)
public void Application_AuthenticateRequest(Object sender, EventArgs e)
{
//executes upon attempting to authenticate the user.
//Extract the forms authentication cookie.
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = new System.Web.HttpCookie();
authCookie = Request.Cookies[cookieName];
}
more code follows but this is where the error is.
on compiliation:
error: System.Web.HttpCookie(); is inaccessible due to its protection level.
the new keyword is underlined blue.
I tried changing the scope of a number of things all of which are likely a
breach of security anyways (since the shell code for global.ascx is
automatically generated by visual studio), and they don't work.
thanks
Chris