Groups | Blog | Home
all groups > dotnet security > august 2005 >

dotnet security : Forms Authentication - how to proceed when valid login?



Rob R. Ainscough
8/17/2005 9:41:14 AM
I've got my Forms Authentication setup, but even with a valid login the
following code just returns me back to my Login form.

My Web.Config
<authentication mode="Forms" >
<forms name="MyAppName" loginUrl="Secure/Logon.aspx"/>
</authentication>

Code in my Logon.aspx
After the user is validated (checks SQL database) I issue the following:
Response.Redirect("Secure/CustomerInfo.aspx?CallFrom=" & SourceLink)

The problem is that it redirects me back to Logon.aspx not to
Secure/CustomerInfo.aspx ?? Is this how Forms authentication is supposed to
work? How do I tell my ASP.NET app that login was successful so please
proceed to appropriate aspx page? Do I have to add to Session state and
have the Page Load check and route accordingly??

Thanks, Rob.

Raymond Yuen
8/17/2005 10:29:02 AM
Hi Rob R. Ainscough,

After you've valided the user name and password using your database records,
you have to issuse an authenticated cookie to the user by either one of the
followings:

System.Web.Security.FormsAuthentication.SetAuthCookie()
or
System.Web.Security.FormsAuthentication.RedirectFromLoginPage()

For details function signature, please refer to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebsecurityformsauthenticationmemberstopic.asp

Raymond

[quoted text, click to view]
AddThis Social Bookmark Button