« Previous Next »

Answered Thread: ASP.NET detected invalid characters in the URL

Last post 11-20-2008 3:08 PM by DanielVL. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 11-18-2008, 11:14 AM

    • k_sega
    • Not Ranked
    • Joined on 10-15-2008, 1:45 PM
    • Posts 11

    ASP.NET detected invalid characters in the URL

    In the post http://forums.iis.net/t/1152682.aspx I've described situation when URL Rewriter + ARR do not allow managed module to work.

    Any managed module causes

    400.0 error whith "ASP.NET detected invalid characters in the URL"

    with exception in event log:
    at System.Web.Security.CookielessHelperClass.RemoveCookielessValuesFromPath()
    at System.Web.HttpContext.Init(HttpRequest request, HttpResponse response)
    at System.Web.HttpContext..ctor(HttpWorkerRequest wr, Boolean initResponseWriter)
    at System.Web.Hosting.PipelineRuntime.CreateContext(IIS7WorkerRequest wr, IntPtr nativeRequestContext)

    Seems that path is empty in that situation. Is it bug of URL Rewriter, or it is ARR problem?
  • 11-18-2008, 12:04 PM In reply to

    • DanielVL
    • Top 75 Contributor
    • Joined on 10-07-2006, 2:00 PM
    • Redmond, WA, USA
    • Posts 109

    Re: ASP.NET detected invalid characters in the URL

    I'm not familiar with this issue, but before going on, Did you make sure to install the latest ARR+Rewrite releases?

    http://www.iis.net/extensions/ApplicationRequestRouting

    http://www.iis.net/extensions/urlrewrite

    Thanks.

    Daniel Vasquez Lopez
    URL Rewrite Engine Developer
  • 11-18-2008, 5:30 PM In reply to

    • k_sega
    • Not Ranked
    • Joined on 10-15-2008, 1:45 PM
    • Posts 11

    Re: ASP.NET detected invalid characters in the URL

    Thank you for quick response.

    Yes, I've rechecked - I use latest version of these extensions.

    As far as I understand if I'll set following rule:

      <rewrite>
        <globalRules>
          <rule name="Proxy" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*" />
            <conditions>
              <add input="{HTTP_HOST}" pattern="*" />
            </conditions>
            <action type="Rewrite" url="http://{C:0}/{R:0}" />
          </rule>
        </globalRules>
      </rewrite>

    URL Rewriter will sent me from http://microsoft.com/somePage.aspx to http://microsoft.com:80/http://microsoft.com/somePage.aspx and then ARR will correctly process it, sending request to microsoft server.

    But in this scenario any managed module will try to parse second link, will get incorrect  symbols and fail.

    Am I right? So, is it ARR issue?

  • 11-20-2008, 3:08 PM In reply to

    • DanielVL
    • Top 75 Contributor
    • Joined on 10-07-2006, 2:00 PM
    • Redmond, WA, USA
    • Posts 109

    Answered Re: ASP.NET detected invalid characters in the URL

    I think your rule will rewrite from http://microsoft.com/somePage.aspx to http://microsoft.com:80/somePage.aspx

    {R:0} will be expanded "/somePage.aspx"

    Please use FRT to see how the rewriting is executed:

    http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/

    Thanks.

    Daniel Vasquez Lopez
    URL Rewrite Engine Developer
Page 1 of 1 (4 items)
Microsoft Communities