Answered by:
how to redirect another page after successful login?

Question
-
hi,
i'm a newbie & currently using a business application template where i want to redirect to my customized page after successful login authentication..
what changes i have to make in my application and at which location?
please help
Saturday, February 2, 2013 8:23 AM
Answers
-
You can subscribe to the WebContext.Current.Authentication.LoggedIn event, something like the following:
WebContext.Current.Authentication.LoggedIn +=(sender, e) => { // The user has logged in, navigate to the correct view }
You could subscribe to this event in the several places, depending on your needs, e.g. in the MainPage.xaml.cs
- Marked as answer by iwpfModerator Monday, February 18, 2013 10:28 AM
Tuesday, February 12, 2013 9:17 AM
All replies
-
So you're using the Login control? Add a handler to the LoginUser_LoggedIn event, and then redirect based on their role, if required.
<asp:Login ID="LoginUser" runat="server" OnLoggedIn="LoginUser_LoggedIn" >
protected void LoginUser_LoggedIn(object sender, EventArgs e) { if (Roles.IsUserInRole(LoginUser.UserName, "Applicant")) Response.Redirect("~/Detail.aspx"); else { Response.Redirect("~/Welcome.aspx"); } }
- Proposed as answer by Christian AmadoMVP Wednesday, February 6, 2013 8:39 PM
Tuesday, February 5, 2013 12:36 AM -
Thanks Christian for your answer,
but I'm using a silverlight Business Application ,Response.Redirect() method doesn't work here, i need to change my xaml.cs file which I think could be LoginStatus.xaml.cs & may be in the following part
private void Authentication_LoggedIn(object sender, AuthenticationEventArgs e)
{
this.UpdateLoginState();
}please reply if you can solve this..
Sunday, February 10, 2013 6:04 AM -
You can subscribe to the WebContext.Current.Authentication.LoggedIn event, something like the following:
WebContext.Current.Authentication.LoggedIn +=(sender, e) => { // The user has logged in, navigate to the correct view }
You could subscribe to this event in the several places, depending on your needs, e.g. in the MainPage.xaml.cs
- Marked as answer by iwpfModerator Monday, February 18, 2013 10:28 AM
Tuesday, February 12, 2013 9:17 AM