How to redirect to the default.aspx page ?
-
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. -
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.Hi Did you try
Response.Redirect("~/")
? or simplyResponse.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
-
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.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) -
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)That will not work if the current folder is not the root.
Navaneeth How to use google | Ask smart questions
-
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.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.
-
That will not work if the current folder is not the root.
Navaneeth How to use google | Ask smart questions
Yes, but he has specified
http://myserver/vpath/default.aspx
andResponse.Redirect("/")
. And I dont think he has pages in the sub folders. :) -
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.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.