Correct way to Redirect for Login

L

LK

Hi,

I have a UserControl which is embedded onto the header of all my web pages.
When I click Signin, I want the user control to record the page I was on
(the full url if possible), and then redirect to the signin page. When the
user has signed in, I want to redirect back to the originating page. I
cannot seem to get this working, short of frigging the url, and wondered if
there is an easier way?

Thanks

LK.
 
M

Martin Carolan

Hello LK,

If you are using forms authentication you can use something like

FormsAuthentication.RedirectToLoginPath();

and .net will handle all the refering URL crap.

Martin.
 
L

LK

Karl and Martin,

Thanks for your replies - dont know how I missed the FormsAuthentication
call! Anyway, when I call FormsAuthentication.RedirectFromLoginPage I am
redirected to the Default webpage, and not the page I was actually viewing.
In my test, I was viewing a product detail page I have for sale, and
expected to go back to it if I choose to sign in on this page using the link
in the header. But instead I returned to the home page, which is not what I
am after. Is there anything else I need to do?

Thanks again!
 
K

Karl Seguin

LK:
Are you simply using RedirectFromLoginPage or are you using
formsauthentication as your authentication mechanism throughout the site?
(ie, specifying FormsAuthentication in the web.config and denying anonymous
users?)

Karl
 

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

Top