开发者

getting back to folder in asp.net

开发者 https://www.devze.com 2023-02-24 05:28 出处:网络
protected void Button1_Click(object sender, EventArgs e) { Response.Redirect(\"Page2.aspx\"); } this is code to go on .aspx but what if 开发者_运维知识库i want to go in Folder in my solution explorer,

protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("Page2.aspx"); } this is code to go on .aspx but what if 开发者_运维知识库i want to go in Folder in my solution explorer, tried with location but it dont work Who knows post it.

this is location > website\admin -news.aspx -project.aspx and i created in news.aspx button go back to admin, and when i hit button location is next > website\admin\admin why he duplicate admin ?


Response.Redirect("~/Folder/Page.aspx");

The tilde ~ is very useful for redirects, it signifies your site root. So wherever you are on the site, you can redirect to folders relative to the domain root. I hope this is what you meant!


if you have admin folder in your application then redirect it

Response.Redirect("admin/page.aspx"); or Response.Redirect("~/admin/page.aspx");

if you don't have admin folder in your application then redirect it

Response.Redirect("page.aspx");

Try this all ...

0

精彩评论

暂无评论...
验证码 换一张
取 消