Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to encode my url in browser.
If i have www.localhost:56789/result/value/page?=2/...
I want to change it to be www.localhost:56789/result/value/ or www.localhost:56789/result/value/12psdkiu83c4uixjo1p329ur8yfh

I use asp.net mvc C# to build by wesbite

What I have tried:

I haven't do anything. Still search how to do it
Posted
Updated 28-Feb-17 2:32am

1 solution

For URL Encode you can use URLEncode()
Reference: HttpServerUtility.UrlEncode Method (String) (System.Web)[^]

But as your requirement is to encode just a piece of plain text, the better option looks to encrypt rather than encoding as that can result in a large text and can be decoded by someone else. Encryption is a more secure option to this.

Check following article for detailed implementation approach-
Encrypt and Decrypt QueryString Parameter Values in ASP.Net using C# and VB.Net[^]

Hope, it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900