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
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to redirect ot desired page after forms authentication

how to redirect ot desired page after forms authentication

Scheduled Pinned Locked Moved ASP.NET
questionsecurityhelptutorial
7 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.
  • R Offline
    R Offline
    rama charan
    wrote on last edited by
    #1

    hi... how can i redirect to desired page after forms authentication is successful from the login page instead of redirecting to "default.aspx" which my application is redirecting to? thanks for help in advance.

    Rama Charan Prasad "Be happy and Keep smiling.Thats what u want always..:)"

    P 1 Reply Last reply
    0
    • R rama charan

      hi... how can i redirect to desired page after forms authentication is successful from the login page instead of redirecting to "default.aspx" which my application is redirecting to? thanks for help in advance.

      Rama Charan Prasad "Be happy and Keep smiling.Thats what u want always..:)"

      P Offline
      P Offline
      PandemoniumPasha
      wrote on last edited by
      #2

      i am not very experienced in ASP.NET but what i would do is put the redirecting code in the pageload event of the default.aspx page. so, when a user is redirected from the login page to the default.aspx page, the code can determine where to redirect the user according to the information stored in the authentication cookie. hope this helps.;)

      R 1 Reply Last reply
      0
      • P PandemoniumPasha

        i am not very experienced in ASP.NET but what i would do is put the redirecting code in the pageload event of the default.aspx page. so, when a user is redirected from the login page to the default.aspx page, the code can determine where to redirect the user according to the information stored in the authentication cookie. hope this helps.;)

        R Offline
        R Offline
        rama charan
        wrote on last edited by
        #3

        thnks for your help and also for trying. thts a good suggestion.but i have solved it by changing my default page which should load after login to "default.aspx" so its working . BUT I dont want to do like that but i want to know how can i redirect to specified page . thnks for help in advance

        Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

        L 1 Reply Last reply
        0
        • R rama charan

          thnks for your help and also for trying. thts a good suggestion.but i have solved it by changing my default page which should load after login to "default.aspx" so its working . BUT I dont want to do like that but i want to know how can i redirect to specified page . thnks for help in advance

          Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

          L Offline
          L Offline
          luckyve
          wrote on last edited by
          #4

          for example you have a page called "abc.aspx" which user should do login here...ok? you need another page called "def.aspx" to appear after the user have login. So you need to define a bool variable forexample " check " ... then set the check ( boolean ) with ur login statement ( checking user name and password ) ...then if the "check" is true then u need to have a code there to redirect to "def.aspx"

          R 1 Reply Last reply
          0
          • L luckyve

            for example you have a page called "abc.aspx" which user should do login here...ok? you need another page called "def.aspx" to appear after the user have login. So you need to define a bool variable forexample " check " ... then set the check ( boolean ) with ur login statement ( checking user name and password ) ...then if the "check" is true then u need to have a code there to redirect to "def.aspx"

            R Offline
            R Offline
            rama charan
            wrote on last edited by
            #5

            thnks for suggestion sorry ,may be i am not clear or not able to understand what you explained me. but as u know once we turn on the forms autenticaion as successful FormsAuthentication.RedirectFromLoginPage(userid, True) then it redirects to "default.aspx" so we have no chance to redirect to desired page using response.redirect or any other way. can u please explan me clearly your logic or procedure ..you may write a dummy code if u wish thnks a lot

            Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

            L 1 Reply Last reply
            0
            • R rama charan

              thnks for suggestion sorry ,may be i am not clear or not able to understand what you explained me. but as u know once we turn on the forms autenticaion as successful FormsAuthentication.RedirectFromLoginPage(userid, True) then it redirects to "default.aspx" so we have no chance to redirect to desired page using response.redirect or any other way. can u please explan me clearly your logic or procedure ..you may write a dummy code if u wish thnks a lot

              Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

              L Offline
              L Offline
              luckyve
              wrote on last edited by
              #6

              if (txtuser.Text.Trim().Length>0 && txtpass.Text.Trim().Length>0 ) { bool Success; //here you should set your dataset = class or any other "if.." to check if the login is true or not . your dataset should return Success ( it meants " out,bool" ) if(Success) { System.Web.HttpContext.Current.Response.Redirect("WebForm2.aspx"); }

              R 1 Reply Last reply
              0
              • L luckyve

                if (txtuser.Text.Trim().Length>0 && txtpass.Text.Trim().Length>0 ) { bool Success; //here you should set your dataset = class or any other "if.." to check if the login is true or not . your dataset should return Success ( it meants " out,bool" ) if(Success) { System.Web.HttpContext.Current.Response.Redirect("WebForm2.aspx"); }

                R Offline
                R Offline
                rama charan
                wrote on last edited by
                #7

                thanks for reply, but its not working the reason i suppose is given below you are using response.redirect() then you not saying that the forms authentication is successful to the server without using the function FormsAuthentication.RedirectFromLoginPage(userid, True) so the page redirection is not working so please suggest me any other way if possible... thank you -- modified at 9:29 Wednesday 21st February, 2007

                Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"

                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