Author: Pmillio | Posted on: 7/5/2009 10:00:18 AM | Views : 243

Hi how would i guard against xss scripting in a url for instance on a search page which is expecting a querystring, i have done this so far; protected void lbtnMainSearch_Click(object sender, EventArgs e) { string strSearchText = Validator.SanitizeURLString(txtSearch.Text.ToString().Trim()); try { Response.Redirect("/search-results/" + HttpUtility.UrlEncode(strSearchText)); ; } catch { } } Then on the search result page; string strUserValue = HttpUtility.UrlEncode((Request.QueryString["q"] != null) ? Request.QueryString["q"].ToString() : ""); Is this the correct way? ...

Go to the complete details ...