You can easily encode and decode string in c#. There is Microsoft library function that you can use to encode.
You can not directly pass everything in URL. Like url string only accepts ?, & and / . so you need to encode it before passing to the browser.
Also if you will try to store raw url in database, It will prompt an error message. one way is to encode the given url and store it.
Sample encoding code is as follows:
Code Snippet
- string result = System.Web.HttpUtility.HtmlEncode(Sample string);
- // other method
- Server.HtmlEncode(TestString)
0 comments:
Post a Comment