Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to redirect user after login?
psylion
#1 Posted : Monday, July 26, 2010 8:29:13 PM(UTC)
Rank: Member
Groups: Registered

Joined: 6/16/2010(UTC)
Posts: 17
Location: Brussels, Belgium
With the Help of Baseless, I create asmall module to login/logout a user from an application.

But when the user log in, there is an automatic redirection to the admin part of Kooboo.

How to avoid that and stay in the application of redirect the user to a specific page in the application?

Psylion
Baseless
#2 Posted : Monday, July 26, 2010 8:52:50 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
If you check your web.config file in the webapp root youll find something like this:

Quote:
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="60" defaultUrl="~/admin"></forms>
</authentication>


loginUrl is the url of the forms authentication default loginpage. If you want to use your own just change the url and it should work.
Default url is where the user is sent after successful login if you use FormsAuthentication.RedirectFromLoginPage()
Baseless
#3 Posted : Monday, July 26, 2010 9:04:35 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 6/10/2010(UTC)
Posts: 141
Location: Sweden
If you want to set your redirect in your controller or such instead then you can also remove the
FormsAuthentication.RedirectFromLoginPage(UserName, RememberLogin) and instead use
FormsAuthentication.SetAuthCookie(UserName, RememberLogin).

Difference between them is that RedirectFromLoginPage both sets identity AND redirect to the loginUrl from web.config.
psylion
#4 Posted : Monday, July 26, 2010 9:31:23 PM(UTC)
Rank: Member
Groups: Registered

Joined: 6/16/2010(UTC)
Posts: 17
Location: Brussels, Belgium
Great, it work perfectly.

Thanks
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.500 seconds.