I have extranet setup and on a page in my site i list these protected pages.
Clicking on them as expected takes me to my login page. This has macro using loginview control and in anonymous template i have Login control. All works fine except for one thing what i want to do is set the destination url so that after logging in they get redirected to the protected page the initially tried to hit.
How would i do this on load event pick up the refer page?
I'm bit surprised that you'd need to set the destination url, it should all be taken care of by the login control, shouldn't it? Don't you get that weird ?returnUrl on the querystring when you're taken to the login page? I've never had to set the destination url explicitely?
You would think however say i have secured page http://mysite/securepage.aspx that goes to the login page but the url is still http://mysite/securepage.aspx now i am positive if in the page_load of login control i was to get current node i would get the login page and not the securepage. which is why i asked should i get refer page instead and set that as destination url. Jonas may give your reponse a go.
Cool, glad it helped - your post reminded me that I should update the package file with the new source, so it's easier to install. So I just did that now. Also added a screencast showing a basic member login setup. http://our.umbraco.org/projects/website-utilities/razorlogin
redirect url after logging in
Guys,
I have extranet setup and on a page in my site i list these protected pages.
Clicking on them as expected takes me to my login page. This has macro using loginview control and in anonymous template i have Login control. All works fine except for one thing what i want to do is set the destination url so that after logging in they get redirected to the protected page the initially tried to hit.
How would i do this on load event pick up the refer page?
Regards
Ismail
Doesn't the login control automatically do this using the ReturnUrl Querystring parameter?
Ismail,
I'm bit surprised that you'd need to set the destination url, it should all be taken care of by the login control, shouldn't it? Don't you get that weird ?returnUrl on the querystring when you're taken to the login page? I've never had to set the destination url explicitely?
Cheers,
/Dirk
Hi Ismail,
I spent some (somewhat painful) hours with this all kinds of approaches for this the other week, here's what worked out for me for a login script:
var requestedUrl = Request.Url.PathAndQuery.ToString();
if (Request["ReturnUrl"]!=null)
{
requestedUrl = Request["ReturnUrl"];
}
string username=Request["username"];
string password=Request["password"];
Dirk and Matt,
You would think however say i have secured page http://mysite/securepage.aspx that goes to the login page but the url is still http://mysite/securepage.aspx now i am positive if in the page_load of login control i was to get current node i would get the login page and not the securepage. which is why i asked should i get refer page instead and set that as destination url. Jonas may give your reponse a go.
Regards
Ismail
Jonas,
That did it many thanks mate.
Regards
Ismail
Ah, nice,
cheers
Jonas
Thanks Jonas,
good work!
Cool, glad it helped - your post reminded me that I should update the package file with the new source, so it's easier to install. So I just did that now. Also added a screencast showing a basic member login setup. http://our.umbraco.org/projects/website-utilities/razorlogin
is working on a reply...