I am using the asp membership provider. What I want to do is redirect the user from the login page. If they try to go to a page and they are not logged in, then it redirects them to the login and sends them back to the page they requested. However, I do have
the generic "login" link. If they click on that, I want to redirect them to a specific page in my site on a successful login. How do I tell the membership provider to send the user to there if they just clicked the login link? Basically, I want to set like
a default redirect page for the login, if they didn't already try to access another page. Any suggestions? Thanks,
mandrews1234
Member
335 Points
579 Posts
Redirect after login
Jun 08, 2009 05:09 PM|LINK
getchinna_sv
Star
12043 Points
2096 Posts
Re: Redirect after login
Jun 08, 2009 06:04 PM|LINK
check this article... http://aspalliance.com/684
guru_sarkar
All-Star
22198 Points
3463 Posts
Re: Redirect after login
Jun 08, 2009 06:08 PM|LINK
IF you using asp.net Login Control : Try setting DestinationPageUrl Property
Second thing you can do it set defaultUrl property of forms authentication tag in web.config like this:
<authentication mode="Forms"> <forms loginUrl="login.aspx" defaultUrl="Default.aspx"></forms> </authentication>Or If you are using Login control catch OnLoggedIn Event and try to redirect manually like below:
protected void OnLoggedIn(object sender, EventArgs e)
{
if(Request.Params["ReturnUrl"] == null)
{
Response.Redirect("CustomPage.aspx");
}
}
Or if you are having your own login control then check this:
http://geekswithblogs.net/ranganh/archive/2005/04/25/37612.aspx