views:

580

answers:

2

Hi,

I'm experiencing a frustrating issue with asp.net.

  1. Open a fresh browser (cleared history, temp files etc...)
  2. Load www.mysite.com/page.aspx?anystring=1234
  3. The page will load as www.mysite.com/page.aspx. The querystring will be gone. Something redirected and deleted it.

But:

  1. Open a fresh browser (cleared history, temp files etc...)
  2. Load any page on www.mysite.com.
  3. Load www.mysite.com/page.aspx?anystring=1234
  4. the querystring is preserved and page.aspx?anystring=1234 loads with the correct values.

If www.mysite.com/page.aspx?anystring=1234 is the first page a user tries to open, the querystring is removed by what looks like a redirect. It doesn't matter what code is on the page or code behind.

Any ideas?

+1  A: 

Cookie based session management in ASP.Net will write a cookie and redirect to see if it gets a cookie back. I have not experienced this eating URL parameters before but this is one thing that does a redirect on first page view.

David Waters
You are bang on. I was using a small piece of code to remember language settings in the masterpage.cs:Response.Cookies.Add(new HttpCookie("Culture", "en-US"));commenting it out preserved the querystring. Now I have to figure out how to get maintain a chosen language using a different method. Thank you very much :)
Paulj
A: 

A few things for you to try:

You could watch the HTTP traffic to see what is happening, using a utility such as ieHttpHeaders for IE or Firebug for FireFox. This way you will be able to watch the parameters being sent in the request and see if the browser is being redirected in an unexpected way.

You may also want to make a test page under the same virtual directory that simply displays the value of the parameter and see if that works, which would narrow it down to a configuration problem or a coding problem within page.aspx.

J c
good ideas, thanks
Paulj
He said it didn't matter what content was in the code behind, so creating a new page sounds like its been already tried.
Allain Lalonde
Maybe, it could also mean he just tried commenting out some code in page.aspx. Note that based on the OP's comment on the accepted answer, it sounds like creating a new page would have been a good sanity check after all. Also note that my first suggestion would also have helped show how the interaction with cookies wasn't working as expected. Was this really an unhelpful answer?
J c