[NUnitAsp-devl] Re: [Nunitasp-users] "The parameter is incorrect" during form submission
Brought to you by:
jlittle82
From: Cory F. <Cor...@mo...> - 2005-04-25 12:48:46
|
Chris Hansen wrote: > I don't think it would be considered a bug since there shouldn't be a > space in a URL. You can check the HTML specifications, but I'm quite > certain that spaces are verboten - unless it is URL encoded. I agree with you that there shouldn't be spaces in a URL. However, I don't like the thought of rewriting all of my code to look like: Response.Redirect(String.Format("MyPage.aspx?t={0}&b={1}", HttpUtility.UrlEncode(myTVal), HttpUtility.UrlEncode(myBVal))); solely because I want to use NUnitASP with it. Remember, the code works just fine in normal use. It is only accessing a page that has a Response.Redirect with spaces in it with NUnitASP that blows up. What that tells me is that when the NUNitASP browser encounters a 302 it isn't encoding the location header before it uses it. But you brought up an interesting point by talking about the HTTP specs. I now think that the root cause is a bug in Microsoft's Response.Redirect. When you call Response.Redirect, IIS sends back a 302 Found: HTTP/1.x 302 Found Server: Microsoft-IIS/5.1 Date: Mon, 25 Apr 2005 12:18:57 GMT X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Location: /SportsConnection/GetScore.aspx?category=Baseball&team=Tampa Bay Devil Rays Cache-Control: private Content-Type: text/html; charset=utf-8 The key interest for me is the location header. That was from a Response.Redirect where I didn't encode the querystring parameters. Looking at the HTTP specs: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 "The field value consists of a single absolute URI. Location = "Location" ":" absoluteURI " so the spec says that it should be "Location:absoluteURI". And from the Addressing URL spec: http://www.w3.org/Addressing/URL/url-spec.txt "Spaces and control characters in URLs must be escaped for transmission in HTTP, as must other disallowed characters." So, I guess that I have a *feature* request, that NUnitASP escape the value from the 302 location header before it uses it to load the next page, since it appears that Response.Redirect sends an invalid location URI. Cory |