vini
vini

Reputation: 4740

URL getting Appended when using Response.Redirect

I have a URL say /Registration/GetName.aspx/?language=English

When i click on a Asp.net Button on the same Page and say Response.Redirect("CheckLoginName.aspx");

It gives me a weird URL

/Registration/GetName.aspx/CheckLoginName.aspx

What should i do

Please Help?

Upvotes: -1

Views: 2288

Answers (2)

Elad Lachmi
Elad Lachmi

Reputation: 10581

You should remove the trailing / before the query string, since it serves no purpose. Your URL should be /Registration/GetName.aspx?language=English. Another option is to have Response.Redirect("../CheckLoginName.aspx"); This should also work.

I think a solution using a relative path is better, since it is location independant. If you move these two files to another URL, there will be no need for code changes.

Upvotes: 0

juanreyesv
juanreyesv

Reputation: 853

You should use "~/" inside your Redirect

So your code will look something like this

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

Hope this helps

Upvotes: 2

Related Questions