title: Problem with passing folder path string to web service function via jQuery.ajax
body: <p>I need to perform asp.net web-service function call via jQuery and pass asp.net application path to it. That's the way I'm trying to do it (code is located within asp.net page, e.g. aspx file):</p>
  
  <pre><code>    var d = "{'str':'&lt;%=System.DateTime.Now.ToString() %&gt;', 'applicationPath':'&lt;%=GetApplicationPath() %&gt;'}";
  
      $.ajax({ type: "POST",
          url: "http://localhost/testwebsite/TestWebService.asmx/Test",
          data: d,
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          error: function (xhr, status, error) {
              var err = eval("(" + xhr.responseText + ")");
              alert(err.Message);
          },
          success: function (msg) {
  
          }
      });
  </code></pre>
  
  <p>That's what GetApplicationPath method looks like:</p>
  
  <pre><code>protected string GetApplicationPath() 
  {
      return HttpUtility.HtmlEncode(Request.PhysicalApplicationPath);
  }
  </code></pre>
  
  <p>And here is a header of web-service function which I'm trying to call:</p>
  
  <pre><code>public void Test(string str, string applicationPath) 
  </code></pre>
  
  <p>Function call works well, but applicationPath parameter doesn't passed correctly. When I debug it I see that backslashes are removed, function gets "C:ProjectsSamplesmytestwebsite" instead of "'C:\Projects\Samples\mytestwebsite\'".</p>
  
  <p>How can I overcome this?</p>