JAMES
asked on
Cant get response.redirect to work with a query string
Hi,
Below is an example of my query string but when I try and use response.redirect I receive 404 error but if I type this into my browser it works fine (it wont for you as I have changed the params for security reasons but the structure is the same as my live one) :-
Response.Redirect("http://www.mysite.com/folder1/folder2/LogonServer?siteID=1&user=james@mysite.com&pwd=password&destination=OS");
Any thoughts?
Thanks.
James.
Below is an example of my query string but when I try and use response.redirect I receive 404 error but if I type this into my browser it works fine (it wont for you as I have changed the params for security reasons but the structure is the same as my live one) :-
Response.Redirect("http://www.mysite.com/folder1/folder2/LogonServer?siteID=1&user=james@mysite.com&pwd=password&destination=OS");
Any thoughts?
Thanks.
James.
Is it only "Logonserver" or any extension it has to the page?
ASKER
To be honest I havent tried anything else with for this as we dont have any others I can test with.
We use response.redirect a lot with other "internal" .aspx pages which works fine usually though.
We use response.redirect a lot with other "internal" .aspx pages which works fine usually though.
I mean, did you miss placing the file extension LogonServer.aspx, in query string? or you have any HTTP handlers to work with those URL formats?
ASKER
This is an external site not directly connected to the calling one.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
One more thing, were you able to call the page url directly, which you are trying to call using Response.Redirect.
If you are able to call that page directly by accessing that, and those query string values working means, you should able to call that from Response.Redirect too.
If you are able to call that page directly by accessing that, and those query string values working means, you should able to call that from Response.Redirect too.
ASKER
Hi,
Yes it works fine if i type it directly which I mentioned in my opening question :-
"if I type this into my browser it works fine "
I will try your suggestion and report back shortly.
many thanks for your help so far.
Yes it works fine if i type it directly which I mentioned in my opening question :-
"if I type this into my browser it works fine "
I will try your suggestion and report back shortly.
many thanks for your help so far.
ASKER
I *think* that technically works but the destination cannot handle the encoding like that so still dont get my desired results.
Any other thoughts?
Any other thoughts?
http://msdn.microsoft.com/en-us/library/zttxte6w.aspx
Try to print the total url string using Response.Write or some other way, before you try with Response.Redirect.
And verify with that url string directly using it through browser.
Try to print the total url string using Response.Write or some other way, before you try with Response.Redirect.
And verify with that url string directly using it through browser.
ASKER
You have done it!
It was my bad on your example. I tried to encode the whole of the query string in one go (lazy me) instead of doing each param individually. After doing this and then concatenates these strings it works great. Maybe it's the @ in the email address on one of the params - who knows!
Anyhoo - thanks a bunch and a well deserved A.
Regards,
James.
It was my bad on your example. I tried to encode the whole of the query string in one go (lazy me) instead of doing each param individually. After doing this and then concatenates these strings it works great. Maybe it's the @ in the email address on one of the params - who knows!
Anyhoo - thanks a bunch and a well deserved A.
Regards,
James.
Thank you James.