I am trying to use response.redirect on a button click event server side but it gives me http 400 bad request error. I was not getting this error before but I just moved the projectto vs 2010 framework 4.0 and I started getting this error.
This is what I am writing:
protected void bOrganizationAddID_Click(object sender, EventArgs e)
{
string MyURL;
MyURL = "addNewPopup.aspx?orgID=" + this.OrganizationID;
Response.Redirect(MyURL);
}
and when i try to build it, the url shown on the page with error is :
http://localhost:2504/padrap/pages/admin/%2fpadrap%2fpages%2fadmin%2faddNewPopup.aspx%3forgID%3d33
instead of being just:
localhost:2504/padrap/pages/admin/addNewPopup.aspx?orgID=33
Can anyone help me out here please. How do I get the redirect to take me to the correct url?
Thanks!
So, I think this is a bug in 4.0 or something, as I tried everything. The workaround is this though:
This worked for me but I dont know why response.redirect is not working.
Thanks!