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. response.redirect

response.redirect

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestion
8 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.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi, Is there another way of directing a user to a new page, when he clicks a button, that is on a different server? I use reponse.redirect, but I heard that is not the best way. Here is an example: The user is on http://intranet/pages/page1.aspx, and when he clicks a button, he loads another page http://server02/pages/page2.aspx in the browser...

    D 1 Reply Last reply
    0
    • P playout

      Hi, Is there another way of directing a user to a new page, when he clicks a button, that is on a different server? I use reponse.redirect, but I heard that is not the best way. Here is an example: The user is on http://intranet/pages/page1.aspx, and when he clicks a button, he loads another page http://server02/pages/page2.aspx in the browser...

      D Offline
      D Offline
      danidanidani
      wrote on last edited by
      #2

      There is nothing wrong with Response.Redirect but do you really need to do this in code? Can't you do it on client-side? Such as using a link button? in that case after click the browser is being redirected straight to the other page as opposed to posting back to your application therefore saving an entire postback.

      Cheers, Dani

      C P 2 Replies Last reply
      0
      • D danidanidani

        There is nothing wrong with Response.Redirect but do you really need to do this in code? Can't you do it on client-side? Such as using a link button? in that case after click the browser is being redirected straight to the other page as opposed to posting back to your application therefore saving an entire postback.

        Cheers, Dani

        C Offline
        C Offline
        CWIZO
        wrote on last edited by
        #3

        Dani: that's "what's wrong with Response.Redirect()" :)

        -------------------------------------------------------- My portfolio & development blog Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!

        D 1 Reply Last reply
        0
        • C CWIZO

          Dani: that's "what's wrong with Response.Redirect()" :)

          -------------------------------------------------------- My portfolio & development blog Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!

          D Offline
          D Offline
          danidanidani
          wrote on last edited by
          #4

          That is wrong with missusing Response.Redirect() (or at least one of them, as we could consider some scenarios where Server.Transfer would be better as well) but not with the feature itself. There are plenty scenarios where it is needed and there is no better alternative.

          Cheers, Dani

          1 Reply Last reply
          0
          • D danidanidani

            There is nothing wrong with Response.Redirect but do you really need to do this in code? Can't you do it on client-side? Such as using a link button? in that case after click the browser is being redirected straight to the other page as opposed to posting back to your application therefore saving an entire postback.

            Cheers, Dani

            P Offline
            P Offline
            playout
            wrote on last edited by
            #5

            Hi, The problem I have is that I build up the URL string via code behind functions and variables, and then sending the user to a page in a window with no toolbar, directory, etc. The user should also not see to which page he is being redirected. If he goes "view source" on the new page or check the properties, that is ok... but he should not see the page URL in the status bar or in the location URL field. Will this still work if I use the link button?

            D 1 Reply Last reply
            0
            • P playout

              Hi, The problem I have is that I build up the URL string via code behind functions and variables, and then sending the user to a page in a window with no toolbar, directory, etc. The user should also not see to which page he is being redirected. If he goes "view source" on the new page or check the properties, that is ok... but he should not see the page URL in the status bar or in the location URL field. Will this still work if I use the link button?

              D Offline
              D Offline
              danidanidani
              wrote on last edited by
              #6

              You can still use your mehtods to create a dynamic URL and still keep it on client side. For example you could use inline code to output the dynamic string built by your methods. something like: [">My Link](<%=) where instead of the hardcoded string you would call your method (make sure it is protected if you use ASP.NET 2.0 or public if ytou use 1.1). In order to open a window with certain options I think you will need to use window.open

              Cheers, Dani

              P 1 Reply Last reply
              0
              • D danidanidani

                You can still use your mehtods to create a dynamic URL and still keep it on client side. For example you could use inline code to output the dynamic string built by your methods. something like: [">My Link](<%=) where instead of the hardcoded string you would call your method (make sure it is protected if you use ASP.NET 2.0 or public if ytou use 1.1). In order to open a window with certain options I think you will need to use window.open

                Cheers, Dani

                P Offline
                P Offline
                playout
                wrote on last edited by
                #7

                Ok, I am not to sure what you mean. Can you maybe give me an example. Yes, for the new window, I use a window.open to open the window.

                D 1 Reply Last reply
                0
                • P playout

                  Ok, I am not to sure what you mean. Can you maybe give me an example. Yes, for the new window, I use a window.open to open the window.

                  D Offline
                  D Offline
                  danidanidani
                  wrote on last edited by
                  #8

                  Sorry, I pasted an example but it was rendered as HTML. Let me try again: <a href="<%=MyFunctionCallHere()%>">My Link</a> hope this works.

                  Cheers, Dani

                  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