Redirecting to Other Pages after Logging In
<p>In my web application, I have 2 users and 2 roles. I want to redirect the users to different pages based on the roles.</p>

<p>I used the following code to Login_LoggedIn event handler:</p>

<pre><code>if(Roles.IsUserInRole(Login.UserName,"Member"))
      Response.Redirect("~Protected/frmMemberHome.aspx");
else if(Roles.IsUserInRole(Login.UserName,"Admin"))
      Response.Redirect("~Admin/frmAdminPanel.aspx");
</code></pre>

<p>Now, this doesn't work for me. the event don't fire itself. In my case, after successful logging only the Login page is refreshed automatically and absolutely nothing happens.</p>

<p>Some of the forums on the Internet suggests to set the DestinationPageURL property of the Login Control of ASP.NET, but my problem is I can not redirect all users to the same URL, I need to change the DestinationPageURL based on roles.</p>

<p>this is my UserLogin page:</p>

<pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/mainLayout.Master" AutoEventWireup="true" CodeBehind="frmUserLogin.aspx.cs" Inherits="OnlineTMS_MIST.frmUserLogin" %&gt;
&lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
    &lt;asp:Login ID="Login" runat="server"
        DisplayRememberMe="False"&gt;
&lt;/asp:Login&gt;
    &lt;/asp:Content&gt;
</code></pre>

<p>I have no idea, what to do. Whatever other forums suggested is the same thing I tried before but not worked for me.</p>
