[Mono-list] ASP.NET Forms Authentication

Kevin Berry kevinbe71 at yahoo.com
Fri Mar 7 23:06:39 EST 2008


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


More information about the Mono-list mailing list