[Mono-dev] ASP Authorisations
Piotr Stulinski
jamjar at gmail.com
Thu Jan 11 03:31:03 EST 2007
Hi
I am still struggling to get ASP Authorisations to work correctly.
Somehow ASP.NET on mono is not checking the lines that are in my
web.config as below...
<location path="secure">
<system.web>
<authorization>
<allow roles="Server_Administrator,Administrator,Auth_Level_0,Auth_Level_1,Auth_Level_2"
/>
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="admin">
<system.web>
<authorization>
<allow roles="Server_Administrator,Administrator" />
<deny users="*,User" />
</authorization>
</system.web>
</location>
My code works 100% on windows using MS .NET it just refuses to work
correctly on linux under mono...
Is this a known bug, lack of functionality or am i simply doing
something wrong...
I have this on my login routine:
System.Web.Security.FormsAuthentication.SetAuthCookie(txtName.Text,false);
System.Web.Security.FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,txtName.Text,DateTime.Now,DateTime.Now.AddMinutes(20),true,pvp.GetRoles(txtName.Text)[0],"/");
String encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie authcookie = new
HttpCookie(FormsAuthentication.FormsCookieName,encryptedTicket);
Response.Cookies.Add(authcookie);
And i have the following in my Globals.asax
if (HttpContext.Current.Request.IsAuthenticated)
{
War3.PvpgnFunctions pvp = new War3.PvpgnFunctions();
HttpContext.Current.User = new
System.Security.Principal.GenericPrincipal(HttpContext.Current.User.Identity,
pvp.GetRoles(HttpContext.Current.User.Identity.Name));
}
Where i add the roles....
It works fine on windows, totally run out of ideas on mono.
Regards
PJS
More information about the Mono-devel-list
mailing list