I am Working on asp.net with two Login page for Staff and Student.When the Login is successful the user will be taken to WELCOME Page.But the problem is I have used RedirectFromLoginPage if the authentication is successful.Here is the code for that.

        protected void Buttontbl1_Click(object sender, EventArgs e)
        {

        if (AuthenticateUser(Textusertbl1.Text,textpastbl1.Text))
        {
            FormsAuthentication.RedirectFromLoginPage(Textusertbl1.Text, CheckBoxtbl1.Checked);

        }
        else
        {
           errorlbl.Text="Invalid Username or Password";
        }

       }

I have given the defaultUrl as WelcomeStaff.aspx so if the authentication is successful the user is redirected to that.This is the code in Web.config file

      <authentication mode="Forms">
      <forms loginUrl="SelectUser.aspx" defaultUrl="welcomeStaff.aspx"/>
      </authentication>
        <authorization>
       <deny users="?"/>
     </authorization>

So,I need the following to be implemented,

  • I want the same for another login.

    -If the authentication is successful the user must be redirected to DefaultUrl="WelcomeStudent.aspx"

  • Its working fine for One Login Page.But I don't know how to implement for two aspx pages

    So,Can we have two defaultUrl for two aspx file? Is there any other way to implement?Iam new to asp.net.Plz help.Thanks in advance

Related posts

Recent Viewed