1

When using WCF Data Services, more specifically in DevExtreme's WCF Odata service in c#, is there any way of encrypting the URL queries? I do not want the client to be able to see/modify the URL in order to get access to the data. I want to know if this level of obscurity is available, even if have authentication for the client and that the client only has rights to one ID.

For example:

/AcountsByIntroducerID?entityID=1234

This URL exposes the ID and also allows a client to change the ID number. Would there be any way in WCF that would allow use to turn the above URL into a encrypted string?

Such as: /JDudfj8ddJFDJSLAFDLJuaeouru0

So this can be decrypted on the server side. Thanks!

4

1 回答 1

2

我有一个类似的问题要解决。为了解决它,我使用了以下模式,我在一个 base 64 字符串中编码了 url 参数。

用一个参数声明你的 WCF

[ServiceContract]
public interface VCIWCFService
{
     [OperationContract]
     [WebGet(UriTemplate = "/{encodedParameters}")]
     string GetSomething();
}

在后端代码中,您可以使用以下代码解码编码参数

  string Url  = HttpUtility.UrlDecode(encodedParameters);
  Url = Convert.FromBase64String(Url );

您可以使用 HttpUtility 类获取特定参数:

Uri myUri = new Uri(string.format("http://www.nothing.com?{0}",Url));
string param1 = HttpUtility.ParseQueryString(myUri.Query).Get("param1");

我使用 Objective-C Ipad 应用程序,并使用逆系统对参数进行编码

于 2013-09-25T19:33:24.130 回答