How to encrypt / decrypt a query string value with out writing a seperate class file. I used
Server.HtmlEncode/Server.HtmlDecode and Server.UrlEncode/Server.UrlDecode. Like below but not working.
// ------ here getting the data from database basing on this userId value.
}
I used HtmlEncode/Decode and UrlEncode/Decode but no use. userId is not encrypted in url link of solution. please anybody have any idea about this issue. let me know.
Hi,
As far as I know, the Server.HtmlEncode method is used to encode to a specified string. For details about it, please check the link below:
http://msdn.microsoft.com/zh-cn/library/ms525347(v=vs.90).aspx
The following script:
The method Server.URLEncode Method applies URL encoding rules, including escape characters, to a specified string.For details about it, please check the link below:
In order to resolve your issue, I would suggest you check the link below which provide a demo about how to encrypt and decrypt the query string with a specified key.
Vinod Bheemi...
Member
55 Points
64 Posts
Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 18, 2012 11:14 AM|LINK
Dear All,
How to encrypt / decrypt a query string value with out writing a seperate class file. I used Server.HtmlEncode/Server.HtmlDecode and Server.UrlEncode/Server.UrlDecode. Like below but not working.
When passing query string value :
string userId = "44";
Response.Redirect("~/Result.aspx?userId="+ Server.HtmlEncode(userId));
When receiving query string value:
if(Request.QueryString["userId"]!=null)
{
string UserId = Sever.HtmlDecode(Request.QueryString["userId"].ToString());
// ------ here getting the data from database basing on this userId value.
}
I used HtmlEncode/Decode and UrlEncode/Decode but no use. userId is not encrypted in url link of solution. please anybody have any idea about this issue. let me know.
Thanks in Advance...
Vinod Bheemisetty
geniusvishal
All-Star
15189 Points
2956 Posts
Re: Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 18, 2012 12:31 PM|LINK
I think it should be like:
if(Request.QueryString["userId"]!=null)
{
}
not Requeset.QueryString
My Website
www.dotnetvishal.com
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 20, 2012 03:35 AM|LINK
Hi,
As far as I know, the Server.HtmlEncode method is used to encode to a specified string. For details about it, please check the link below:
http://msdn.microsoft.com/zh-cn/library/ms525347(v=vs.90).aspx
The following script:
<%= Server.HTMLEncode("The paragraph tag: <P>") %>Produces the following output:
The following script:
<%= Server.HTMLEncode("44") %>Produces the following output:
The method Server.URLEncode Method applies URL encoding rules, including escape characters, to a specified string.For details about it, please check the link below:
http://msdn.microsoft.com/en-us/library/ms525738(v=vs.90).aspx
They do not meet your reqirement.
In order to resolve your issue, I would suggest you check the link below which provide a demo about how to encrypt and decrypt the query string with a specified key.
http://www.codeproject.com/Articles/33350/Encrypting-Query-Strings
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
Vinod Bheemi...
Member
55 Points
64 Posts
Re: Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 20, 2012 05:02 AM|LINK
Thank you very much... Catherine Shan
With your clear explanation of HtmlEncode/Decode, i understood well about HtmlEncoding/Decoding. Thanks once again.
Vinod Bheemisetty
Vinod Bheemi...
Member
55 Points
64 Posts
Re: Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 20, 2012 05:03 AM|LINK
Thanks for your reply... geniusvishal.
It was a typing mistake. Just i edit it now.
Vinod Bheemisetty
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: Encrypting/Decrypting a querystring value with out write any seperate class file.
Sep 20, 2012 05:53 AM|LINK
Hi,
Very glad to help you. In order to resolve your issue, please check the link I provided which meet help you out.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store