Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. 2 master pages & 2 roles.

2 master pages & 2 roles.

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gerrybrennan
    wrote on last edited by
    #1

    Hi I have an application. There are two roles (admin & user) set up. I have 3 dynamic master pages. (admin & user & a master page for the state when notloggedin) There fore all my webforms have MasterPageFile="" set for either user.master admin.master notlogin.master On my login page i have a login control and when I login successfully i want to specify a destination url dynamically any help please

    P N 2 Replies Last reply
    0
    • G gerrybrennan

      Hi I have an application. There are two roles (admin & user) set up. I have 3 dynamic master pages. (admin & user & a master page for the state when notloggedin) There fore all my webforms have MasterPageFile="" set for either user.master admin.master notlogin.master On my login page i have a login control and when I login successfully i want to specify a destination url dynamically any help please

      P Offline
      P Offline
      Petr Pechovic
      wrote on last edited by
      #2

      Hi, One option could be: Don't use Login Control. Create just 2 textboxes and one button. On the button click you can have this action:

      protected void Signin_click(object sender, object args) {

              if (Membership.ValidateUser(txtLogin.Text, txtPassword.Text)) {
                  // login successful
                  FormsAuthentication.SetAuthCookie(txtLogin.Text, false);
                  string returnUrl = Request.QueryString\["ReturnUrl"\];
                  if (string.IsNullOrEmpty(returnUrl)) {
      
                      if (admin) {
                         Response.Redirect("my\_admin\_page.aspx", false);
                      } else if (user) {
                         Response.Redirect("my\_user\_page.aspx", false);
                      }
                  } else {
                      Response.Redirect(returnUrl, false);
                  }
              } else {
                  // give user the message that login failed!
              }
          }
      

      Petr Pechovic

      N 1 Reply Last reply
      0
      • P Petr Pechovic

        Hi, One option could be: Don't use Login Control. Create just 2 textboxes and one button. On the button click you can have this action:

        protected void Signin_click(object sender, object args) {

                if (Membership.ValidateUser(txtLogin.Text, txtPassword.Text)) {
                    // login successful
                    FormsAuthentication.SetAuthCookie(txtLogin.Text, false);
                    string returnUrl = Request.QueryString\["ReturnUrl"\];
                    if (string.IsNullOrEmpty(returnUrl)) {
        
                        if (admin) {
                           Response.Redirect("my\_admin\_page.aspx", false);
                        } else if (user) {
                           Response.Redirect("my\_user\_page.aspx", false);
                        }
                    } else {
                        Response.Redirect(returnUrl, false);
                    }
                } else {
                    // give user the message that login failed!
                }
            }
        

        Petr Pechovic

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Petr Pechovic wrote:

        Don't use Login Control.

        Yes, use the Login control. Override the appropriate methods, like OnLoggedIn[^]. There is no need to reinvent the wheel.


        I know the language. I've read a book. - _Madmatt

        P 1 Reply Last reply
        0
        • G gerrybrennan

          Hi I have an application. There are two roles (admin & user) set up. I have 3 dynamic master pages. (admin & user & a master page for the state when notloggedin) There fore all my webforms have MasterPageFile="" set for either user.master admin.master notlogin.master On my login page i have a login control and when I login successfully i want to specify a destination url dynamically any help please

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Use the Login control. Override the appropriate methods, like OnLoggedIn[^].


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • N Not Active

            Petr Pechovic wrote:

            Don't use Login Control.

            Yes, use the Login control. Override the appropriate methods, like OnLoggedIn[^]. There is no need to reinvent the wheel.


            I know the language. I've read a book. - _Madmatt

            P Offline
            P Offline
            Petr Pechovic
            wrote on last edited by
            #5

            That's why I wrote "one option could be" ;) :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups