WCF Data Services not escaping pound sign (aka hash, #) RRS feed

  • Question

  • I'm using LINQ to get data from a WCF Data Service (Framework 3.5), but I'm having a problem whenever the query contains a '#'.  

    The URL generated by the LINQ query looks like this:

    http://www.somesite.com:1839/PolicyAdmin.svc/CustomerPolicySearch()?$filter=PolicyNo eq '#040981'

    And the results in the this error:

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
          <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
              <code />
              <message xml:lang="en-US">Unterminated string literal at position 13 in 'PolicyNo eq ''.</message>

    I really hope there is some kind of easy fix for this.
    Monday, February 1, 2010 7:30 PM