Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF DataServices Service Operation Parameter - Character Replacement
    text
    copied!<p>I've a very strange problem (using SL5, WCF DataServices 5.0.1): I've a ServiceOperation with 2 String parameters (Username, Password) which checks if the users exists</p> <pre><code>public IQueryable&lt;User&gt; Login(string username, string password) {...} </code></pre> <p>When I try to call this everythings works fine, except the case that the password-hash contains a '+' character in it. In this case, it seems if it is replaced by a whitespace-character:</p> <pre><code>var pwd = CRQWKrKzCcQVnlhk2zl0j5QM+c5ujQGMv0XXnh4genI= this.Context.BeginExecute&lt;User&gt;(new Uri(string.Format("/Login?username='{0}'&amp;password='{1}'", username, pwd), UriKind.Relative), (ar) =&gt; { .. }, null); </code></pre> <p>If I grab that with Fiddler, the Request-Header seems ok to me...</p> <pre><code>GET /Service.svc/Login?username='xyz'&amp;password='CRQWKrKzCcQVnlhk2zl0j5QM+c5ujQGMv0XXnh4genI=' HTTP/1.1 </code></pre> <p>But in the WebForms-Tab the Password-QueryString already has a whitespace instead of the '+'. Same result if I debug that on the Server...</p> <p>Does anyone of you know why the '+' is replaced? Are there other invalid characters? How can I avoid that?</p> <p><b>Update/EDIT :</b></p> <p>Surprisingly the following query works as expected:</p> <pre><code>var query = (DataServiceQuery&lt;User&gt;) from c in this.Context.Users where c.Username.Equals(username.ToLower()) &amp;&amp; c.Password.Equals(Cryptography.ComputeSha256Hash(password + username.ToLower())) select c; </code></pre> <p>Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload