Click here to Skip to main content
15,888,003 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionError: The resource cannot be found. Pin
Member 876166711-Sep-14 8:42
Member 876166711-Sep-14 8:42 
AnswerRe: Error: The resource cannot be found. Pin
ZurdoDev11-Sep-14 8:45
professionalZurdoDev11-Sep-14 8:45 
GeneralRe: Error: The resource cannot be found. Pin
Member 876166711-Sep-14 9:03
Member 876166711-Sep-14 9:03 
AnswerRe: Error: The resource cannot be found. Pin
ZurdoDev11-Sep-14 9:06
professionalZurdoDev11-Sep-14 9:06 
GeneralRe: Error: The resource cannot be found. Pin
Member 876166711-Sep-14 9:15
Member 876166711-Sep-14 9:15 
AnswerRe: Error: The resource cannot be found. Pin
ZurdoDev11-Sep-14 9:31
professionalZurdoDev11-Sep-14 9:31 
GeneralRe: Error: The resource cannot be found. Pin
Member 876166711-Sep-14 9:33
Member 876166711-Sep-14 9:33 
SuggestionRe: Error: The resource cannot be found. Pin
Richard Deeming11-Sep-14 9:49
mveRichard Deeming11-Sep-14 9:49 
A word of warning: Don't do what Ryan said. (Or at least, not exactly what he said!)

When you take a value from the request and want to re-display it, you need to make sure it's properly encoded. In this case, since you're display it as text within the HTML of the page, you need to use the HttpUtility.HtmlEncode method[^] to encode the string before showing it in a label.

The reason you need to encode it before displaying it is to prevent a cross-site scripting (XSS)[^] attack. Since the query-string could be modified by the user, they could pass in any HTML or javascript. If your code blindly copies that to the response, they can execute that script within your page. Since it's just a link, they could send that out to anyone they think might use your site, and anyone who clicked on the link would suddenly find that their authentication cookies have been stolen, or that your site has installed malware on their device.

You should never trust any input that comes from the user, whether it's in the query-string, part of a POST request, or even the HTTP headers. Always assume that all users are trying to hack into your site, and use the appropriate defences. Smile | :)



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Error: The resource cannot be found. Pin
Member 876166711-Sep-14 10:16
Member 876166711-Sep-14 10:16 
GeneralRe: Error: The resource cannot be found. Pin
Richard Deeming12-Sep-14 1:37
mveRichard Deeming12-Sep-14 1:37 
GeneralRe: Error: The resource cannot be found. Pin
Member 876166713-Sep-14 8:34
Member 876166713-Sep-14 8:34 
GeneralRe: Error: The resource cannot be found. Pin
Richard Deeming15-Sep-14 1:56
mveRichard Deeming15-Sep-14 1:56 
GeneralRe: Error: The resource cannot be found. Pin
Member 876166715-Sep-14 2:30
Member 876166715-Sep-14 2:30 
GeneralRe: Error: The resource cannot be found. Pin
ZurdoDev11-Sep-14 10:53
professionalZurdoDev11-Sep-14 10:53 
QuestionMVC jQuery dropdown context menu Pin
Stephen Holdorf11-Sep-14 3:35
Stephen Holdorf11-Sep-14 3:35 
QuestionViewstate spider web Pin
Ali Al Omairi(Abu AlHassan)10-Sep-14 22:20
professionalAli Al Omairi(Abu AlHassan)10-Sep-14 22:20 
AnswerRe: Viewstate spider web Pin
thatraja11-Sep-14 2:09
professionalthatraja11-Sep-14 2:09 
AnswerRe: Viewstate spider web Pin
Sibeesh KV29-Sep-14 1:21
professionalSibeesh KV29-Sep-14 1:21 
QuestionCurrent date Pin
Otekpo Emmanuel10-Sep-14 12:39
Otekpo Emmanuel10-Sep-14 12:39 
AnswerRe: Current date Pin
Ali Al Omairi(Abu AlHassan)10-Sep-14 22:08
professionalAli Al Omairi(Abu AlHassan)10-Sep-14 22:08 
GeneralRe: Current date Pin
Otekpo Emmanuel10-Sep-14 23:23
Otekpo Emmanuel10-Sep-14 23:23 
GeneralRe: Current date Pin
Ali Al Omairi(Abu AlHassan)11-Sep-14 1:29
professionalAli Al Omairi(Abu AlHassan)11-Sep-14 1:29 
GeneralRe: Current date Pin
Otekpo Emmanuel11-Sep-14 3:15
Otekpo Emmanuel11-Sep-14 3:15 
GeneralRe: Current date Pin
Richard Deeming11-Sep-14 3:50
mveRichard Deeming11-Sep-14 3:50 
GeneralRe: Current date Pin
Otekpo Emmanuel11-Sep-14 7:45
Otekpo Emmanuel11-Sep-14 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.