Tuesday 12 April 2016

encode and decode query string asp.net

Use below code to encode the query string using AntiXSS library for it you need to refer the antixss library in your code.

What is Antixsslibrary ?
It helps you to protect your code from cross site scripting. It helps to encode the text.
Cross site scripting (XSS) occurs  mostly on  due following .
1. When Dynamically data changing.
2. Passing the data through query string.
3. Displaying data to UI which is allowing to insert from user (they can insert the script aswell)
4. Showing any messages to UI.

clear controls in asp.net

Suppose you have the list of input control that you want to clear it after saving the records or updating the records, you can use the generic method and that you can call from your derived class and pass the control.

Use below method  for same it will clear your input control from C# code behind.