Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Please help me any body.....

i want to find out querystrings in a webform using with asp.net application and my requirement is i want to write a method to find how many querystrings are useing in a webform.

Actually i want to know how many querystrings are used in a webform and using with querystring count, i want to retrive the querystring value.
Posted
Comments
Thanks7872 16-Jun-14 9:11am    
Why? How will you get CORRECT data using the count? check the querystring is null or not instead.
Kapuraveni BharathKumar 16-Jun-14 9:19am    
Hi rohan,

purpose to want this preventing cross site scripting. i was already checked their is no null values. so i want to change all querystring values using with server.html(request.querystring("values")).now i want to write a method for find how many querystrings are used in a webform. can u help me ?
Thanks7872 16-Jun-14 9:26am    
I am still confused. Why you relate query string count with scripting attacks? What will be the difference if count is 4 or 5?
Nandakishore G N 16-Jun-14 10:32am    
To avoid cross side scripting there are many other ways. follow this link and I don't think count of querystring helps you ..
http://www.codeproject.com/Articles/617043/Hack-Proof-Your-ASP-NET-Application-From-Cross-Sit

1 solution

try this.. :)

C#
protected void Page_Load(object sender, EventArgs e)
       {
           int TotalCount = QueryStringCount();
       }

       public int QueryStringCount()
       {
           int QueryCount = 0;

           QueryCount = Request.QueryString.Count;

           return QueryCount;

       }
 
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