[Mono-list] ASP.NET Forms Authentication

Kevin Berry kevinbe71 at yahoo.com
Tue Mar 11 09:55:04 EDT 2008


I haven't seen any replies on this yet.  Is anyone using forms authentication in this way?

On Mar 7, 2008, at 11:06 PM, Kevin Berry <kevinbe71 at yahoo.com> wrote:

I can't get forms authentication to work under XSP
2.0.  I'm using the following code in my login button
click event handler if the login entered is correct:

FormsAuthentication.Initialize();
String strRole = assignRoles(loginTextBox.Text);

//The AddMinutes determines how long the user will be
logged in after leaving
//the site if he doesn't log off.
FormsAuthenticationTicket fat = new
FormsAuthenticationTicket(1, loginTextBox.Text,
DateTime.Now, DateTime.Now.AddMinutes(30), false,
strRole, FormsAuthentication.FormsCookiePath);

Response.Cookies.Add(new
HttpCookie(FormsAuthentication.FormsCookieName,
FormsAuthentication.Encrypt(fat)));

Response.Redirect(FormsAuthentication.GetRedirectUrl(loginTextBox.Text,
false));

In the Web.config file I have:
<location path="Protected">
 <system.web>
   <authorization>
     <allow roles="admin"/>
     <allow roles="stduser"/>
     <deny users="*"/>
   </authorization>
 </system.web>
</location>

<authentication mode="Forms">
 <forms name="login" 
            loginUrl="LoginPage.aspx" 
            defaultUrl="Default.aspx" 
            protection="All" 
            timeout="30" 
            path="/" 
            requireSSL="false" 
            slidingExpiration="true" 
            cookieless="UseDeviceProfile" 
            domain="" 
            enableCrossAppRedirects="false"/>
</authentication>

<authorization>
 <allow users="*"/>
</authorization>

This works with VS 2005 and the ASP.NET web dev
server.  Why doesn't this work with Mono's XSP 2.0 web
server?  Is there something I can change to make sure
this works?

NOTE: I'm using Mono 1.2.6 under Windows Vista x64 but
plan to move this to a Linux Apache web server once I
have it working on Windows.  Surely this doesn't make
any difference though...

Thanks,
Kevin.



     ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



More information about the Mono-list mailing list