Cannot redirect to desire page

G

Grey

I have set the following parameters in web.config to prevent user direct
access the web page without user login.
<authentication mode="Forms">
<forms loginUrl="Initial/index.aspx" name="adAuthCookie"
timeout="60" path="/" >
</forms>
</authentication>

The application did success to redirect to login page, but it cannot
redirect back to desire page which I specify in URL. What's wrong with my
setting or do i need to add some code in the aspx file??

Million Thanks
 
D

Dave Fancher

Here's a code sample for redirection. You'll be most interested in the line
reading "FormsAuthentication.RedirectFromLoginPage(...)" under step 4:
http://msdn.microsoft.com/library/d...uide/html/cpconsimplecookieauthentication.asp.

Also, take a look at the documentation for the FormsAuthentication class
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html
/frlrfsystemwebsecurityformsauthenticationmemberstopic.asp) for more
information regarding the RedirectFromLoginPage() method.

I've not used forms authentication extensively but I played with it a while
back. If memory (and a little reading) serves me correctly, when accessing
a site under forms authentication, the user is redirected from the page
being requested to the login page. Upon successful
authentication/authorization, the RedirectFromLoginPage() method will return
the user to the originally requested page. You can check the value returned
by the GetRedirectUrl() method to determine which page was originally
requested and determine from there if you should use RedirectFromLoginPage()
or Response.Redirect (or Server.Transfer).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top