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. General Programming
  3. C#
  4. Response.redirect

Response.redirect

Scheduled Pinned Locked Moved C#
helpquestioncsharp
9 Posts 5 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.
  • A Offline
    A Offline
    acodman
    wrote on last edited by
    #1

    Can someone please tell me what is wrong with this code in C# have 2 web pages: page A and PageB in page_load event for pageA I want the page to assign a value into a session variable and redirects to pageB, like this: PageA Session["Refid"]=1; Respone.Redirect("pageb?refid="+ Session["Refid"]); . When I step run my codebehind by pressing F10, I notice it goes to the catch Exception part of my try...catch event and still redirects to pageB which shoudn't be. I believe once an error is raised it should print the error message instead of redirecting to pageB. can someone help me out. Thanks

    C P A 3 Replies Last reply
    0
    • A acodman

      Can someone please tell me what is wrong with this code in C# have 2 web pages: page A and PageB in page_load event for pageA I want the page to assign a value into a session variable and redirects to pageB, like this: PageA Session["Refid"]=1; Respone.Redirect("pageb?refid="+ Session["Refid"]); . When I step run my codebehind by pressing F10, I notice it goes to the catch Exception part of my try...catch event and still redirects to pageB which shoudn't be. I believe once an error is raised it should print the error message instead of redirecting to pageB. can someone help me out. Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What is the exception ?

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      A P 2 Replies Last reply
      0
      • A acodman

        Can someone please tell me what is wrong with this code in C# have 2 web pages: page A and PageB in page_load event for pageA I want the page to assign a value into a session variable and redirects to pageB, like this: PageA Session["Refid"]=1; Respone.Redirect("pageb?refid="+ Session["Refid"]); . When I step run my codebehind by pressing F10, I notice it goes to the catch Exception part of my try...catch event and still redirects to pageB which shoudn't be. I believe once an error is raised it should print the error message instead of redirecting to pageB. can someone help me out. Thanks

        P Offline
        P Offline
        Parwej Ahamad
        wrote on last edited by
        #3

        Plz use this........ Response.Redirect(url, False)

        Parwej Back...............DON of Developer....... Parwej Ahamad g_parwez@rediffmail.com

        1 Reply Last reply
        0
        • C Christian Graus

          What is the exception ?

          Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

          A Offline
          A Offline
          acodman
          wrote on last edited by
          #4

          it doesn't print out any exception instead. I just taught something is wrong bcos when I comment that part and step run my codes it runs (without going to the next page) and does not go the catch exception segement. when you remove the comment and step run the program again, when it gets to the response.redirect, it jumps straight to the catch exception segment after which it redirects to pageB. if you can give me an example that works I don't mind. thanks for taking out time to look at my issues. expect to get more clues from you. thanks.

          1 Reply Last reply
          0
          • A acodman

            Can someone please tell me what is wrong with this code in C# have 2 web pages: page A and PageB in page_load event for pageA I want the page to assign a value into a session variable and redirects to pageB, like this: PageA Session["Refid"]=1; Respone.Redirect("pageb?refid="+ Session["Refid"]); . When I step run my codebehind by pressing F10, I notice it goes to the catch Exception part of my try...catch event and still redirects to pageB which shoudn't be. I believe once an error is raised it should print the error message instead of redirecting to pageB. can someone help me out. Thanks

            A Offline
            A Offline
            Ajay R Ojha
            wrote on last edited by
            #5

            hi acodman, I think that response.redirect work even for most exceptions. try putting the aspx page extention and convert the session to string Respone.Redirect("pageb.aspx?refid="+ Session["Refid"].ToString() ); i think this should work

            B A 2 Replies Last reply
            0
            • C Christian Graus

              What is the exception ?

              Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

              P Offline
              P Offline
              Parwej Ahamad
              wrote on last edited by
              #6

              Thread abort like...........

              Parwej Back...............DON of Developer....... Parwej Ahamad g_parwez@rediffmail.com

              1 Reply Last reply
              0
              • A Ajay R Ojha

                hi acodman, I think that response.redirect work even for most exceptions. try putting the aspx page extention and convert the session to string Respone.Redirect("pageb.aspx?refid="+ Session["Refid"].ToString() ); i think this should work

                B Offline
                B Offline
                blue_arc
                wrote on last edited by
                #7

                always cast ur data before u use it.. Ajay has send the right thing.. Respone.Redirect("pageb.aspx?refid="+ Session["Refid"].ToString() );

                A 1 Reply Last reply
                0
                • B blue_arc

                  always cast ur data before u use it.. Ajay has send the right thing.. Respone.Redirect("pageb.aspx?refid="+ Session["Refid"].ToString() );

                  A Offline
                  A Offline
                  acodman
                  wrote on last edited by
                  #8

                  thanks you very much.

                  1 Reply Last reply
                  0
                  • A Ajay R Ojha

                    hi acodman, I think that response.redirect work even for most exceptions. try putting the aspx page extention and convert the session to string Respone.Redirect("pageb.aspx?refid="+ Session["Refid"].ToString() ); i think this should work

                    A Offline
                    A Offline
                    acodman
                    wrote on last edited by
                    #9

                    thanks Ajah.

                    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