Reputation: 1814
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!
Upvotes: 1
Views: 1097
Reputation: 2016
I had a similar problem to solve. For solve it i used the following pattern I have encoded url parameters in one base 64 string.
Declare your WCF with one parameter
[ServiceContract]
public interface VCIWCFService
{
[OperationContract]
[WebGet(UriTemplate = "/{encodedParameters}")]
string GetSomething();
}
In backend code you can decode encodedParameters with the following code
string Url = HttpUtility.UrlDecode(encodedParameters);
Url = Convert.FromBase64String(Url );
and you can get a particular parameter with HttpUtility class :
Uri myUri = new Uri(string.format("http://www.nothing.com?{0}",Url));
string param1 = HttpUtility.ParseQueryString(myUri.Query).Get("param1");
I work with Objective-C Ipad app, and i encode the parameters with the inverse system
Upvotes: 2