Risho
Risho

Reputation: 2647

Redirecting to up one level with Response.Redirect

I have user control that uses a Response.Redirect("Default.aspx"). The problem starts when this control is used in files that are located in subdirectories and I try to redirect up a level.

Conversely, if I use ../Default.aspx, redirects in the top level will break.

Is there another way to code this?

Upvotes: 1

Views: 3096

Answers (2)

Sandeep Jadhav
Sandeep Jadhav

Reputation: 928

if you want to go up level directory or your Default.aspx page in main directory go at link https://stackoverflow.com/a/16277982/7300644

or use

Response.Redirect("~/Default.aspx");

or

Response.Redirect("../Default.aspx");

Upvotes: 1

Nabeel Bape
Nabeel Bape

Reputation: 60

Why not use complete path, something like this,

Response.Redirect("~/directory/subdirectory/Default.aspx");

Upvotes: 0

Related Questions