Solved

Cant get response.redirect to work with a query string

Posted on 2008-06-09
11
396 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:JAMES
  • 6
  • 5
11 Comments
 
LVL 7

Expert Comment

by:ydramu
Comment Utility
Is it only "Logonserver" or any extension it has to the page?
0
 

Author Comment

by:JAMES
Comment Utility
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.
0
 
LVL 7

Expert Comment

by:ydramu
Comment Utility
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?
0
 

Author Comment

by:JAMES
Comment Utility
This is an external site not directly connected to the calling one.
0
 
LVL 7

Accepted Solution

by:
ydramu earned 500 total points
Comment Utility
Could you please try with encoding your query string values before passing them to the url, as below.

queryString = "bob";

enQueryString = Server.URLencode(queryString);

queryString1 = "bob@test.com";

enQueryString1 = Server.URLencode(queryString1);

Response.Redirect("http://www.mysite.com/folder1/folder2/LogonServer?siteID=" + enQueryString + "&user=" + queryString1);



I gave this as example, but not as per your requirement.

And also make sure, the query string variable names, like siteID, user, etc...are matching as per the external site requirement.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 7

Expert Comment

by:ydramu
Comment Utility
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.
0
 

Author Comment

by:JAMES
Comment Utility
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.
0
 

Author Comment

by:JAMES
Comment Utility
I *think* that technically works but the destination cannot handle the encoding like that so still dont get my desired results.

Any other thoughts?
0
 
LVL 7

Expert Comment

by:ydramu
Comment Utility
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.

0
 

Author Comment

by:JAMES
Comment Utility
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.
0
 
LVL 7

Expert Comment

by:ydramu
Comment Utility
Thank you James.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now