how can we apply client side validation on fileupload control in ASP.NET to check filename contain s

Posted by subodh on Stack Overflow See other posts from Stack Overflow or by subodh
Published on 2010-05-24T06:15:12Z Indexed on 2010/05/24 6:21 UTC
Read the original article Hit count: 281

Filed under:
|
|

I am working on ASP.NET3.5 platform. I have used a file upload control and a asp button to upload a file. Whenever i try to upload a file which contain special characterlike (file#&%.txt) it show

crash and give the messeage

Server Error in 'myapplication' Application.

A potentially dangerous Request.Files value was detected from the client (filename="...\New Text &#.txt"). Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case.

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Files value was detected from the client (filename="...\New Text &#.txt").

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


how can i prevent this crash using javascript at client side?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET