user3804364
user3804364

Reputation: 23

how to redirect from a page in a folder to the page in root directory?

I have a folder admin in my project. the main home is outside this folder. I want to redirect to the mainhome.aspx in the logout button click event of a page which is in the admin folder.

what I did is :

Code

Response.Redirect("mainhome.aspx");

but it is not redirecting to the mainhome.aspx page.

Upvotes: 2

Views: 123

Answers (2)

mybirthname
mybirthname

Reputation: 18127

You can write it like this:

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

Upvotes: 2

Mad Dog Tannen
Mad Dog Tannen

Reputation: 7244

Set the root level, / now its looking for mainhome.aspx in your admin folder

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

Upvotes: 1

Related Questions