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 to the default.aspx page ?

How to redirect to the default.aspx page ?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nettutorial
7 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.
  • D Offline
    D Offline
    David Mujica
    wrote on last edited by
    #1

    This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx. I tried, Response.Redirect("/"), but that put me too far back and did not include my virtual path. The proper path should be something like this: http://myserver/vpath/default.aspx What is the proper way of redirecting back to the home page ? Thanks.

    T R H D 4 Replies Last reply
    0
    • D David Mujica

      This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx. I tried, Response.Redirect("/"), but that put me too far back and did not include my virtual path. The proper path should be something like this: http://myserver/vpath/default.aspx What is the proper way of redirecting back to the home page ? Thanks.

      T Offline
      T Offline
      Talal Sultan
      wrote on last edited by
      #2

      Hi Did you try Response.Redirect("~/")? or simply Response.Redirect("~/default.aspx")? Talal

      -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

      1 Reply Last reply
      0
      • D David Mujica

        This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx. I tried, Response.Redirect("/"), but that put me too far back and did not include my virtual path. The proper path should be something like this: http://myserver/vpath/default.aspx What is the proper way of redirecting back to the home page ? Thanks.

        R Offline
        R Offline
        Rutvik Dave
        wrote on last edited by
        #3

        Just use Response.Redirect("Default.aspx"); And when you want to refer to sub folder then either use "./FolderName/FileName" or "~/FolderName/FileName" (like the previous poster suggested)

        N 1 Reply Last reply
        0
        • R Rutvik Dave

          Just use Response.Redirect("Default.aspx"); And when you want to refer to sub folder then either use "./FolderName/FileName" or "~/FolderName/FileName" (like the previous poster suggested)

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          That will not work if the current folder is not the root.

          Navaneeth How to use google | Ask smart questions

          R 1 Reply Last reply
          0
          • D David Mujica

            This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx. I tried, Response.Redirect("/"), but that put me too far back and did not include my virtual path. The proper path should be something like this: http://myserver/vpath/default.aspx What is the proper way of redirecting back to the home page ? Thanks.

            H Offline
            H Offline
            Hampden Tech
            wrote on last edited by
            #5

            I may be missing something but Response.Redirect("default.aspx", True) should work. If your default.aspx file is in a different subfolder, for example "Main" you would use... Response.Redirect("../Main/default.aspx", True). Hope this helps.

            1 Reply Last reply
            0
            • N N a v a n e e t h

              That will not work if the current folder is not the root.

              Navaneeth How to use google | Ask smart questions

              R Offline
              R Offline
              Rutvik Dave
              wrote on last edited by
              #6

              Yes, but he has specified http://myserver/vpath/default.aspx and Response.Redirect("/"). And I dont think he has pages in the sub folders. :)

              1 Reply Last reply
              0
              • D David Mujica

                This is probably a very simple question, but I'm working on my first ASP.NET application. I want to use the response.redirect function to send my application back to the start of the website. The main page of the site is default.aspx. I tried, Response.Redirect("/"), but that put me too far back and did not include my virtual path. The proper path should be something like this: http://myserver/vpath/default.aspx What is the proper way of redirecting back to the home page ? Thanks.

                D Offline
                D Offline
                David Mujica
                wrote on last edited by
                #7

                Wow. Such a simple answer. Goes to show you what happens when you "overthink" a solution. Thanks to all. :rose: I'm sure I'll have more questions as I continue to develop this first applicaiton.

                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