Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 812061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:08:41+00:00 2026-05-15T01:08:41+00:00

I am working on ASP.NET3.5 platform. I have used a file upload control and

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:08:42+00:00Added an answer on May 15, 2026 at 1:08 am

    A very simple solution is to validate the filename on click of the button (or some other control) that triggers upload like this and stop upload if there is some problem with filename:

    <asp:FileUpload ID="fu1" runat="server" />
    <asp:Button ID="btn" runat="server" CausesValidation="true" Text="Click" 
               OnClientClick="return ValidateFileName();" /> 
    
    <script type="text/javascript">
        function ValidateFileName() {
            var fu = document.getElementById("<%= fu1.ClientID %>");
            var f = fu.value + "";
            if ((f.indexOf("#", 0) >= 0) || (f.indexOf("$", 0) >= 0) ||
                  (f.indexOf("%", 0) >= 0) || (f.indexOf("^", 0) >= 0)) {
                alert("Filename: [" + f + "] contains invalid char");
                return false;//will stop button click event here
            }
    
            return true;
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on asp.net 3 application. I have a view which is report
Currently, I have a ASP.net 3.5 web application for which I currently am working
I'm working on an ASP.NET MVC 2 / .NET 3.5 project which includes SSRS
Good Morning, I'm working on an ASP.NET 3.5 webforms application and have written the
I'm working on a .Net application which uses Asp.net 3.5 and Lucene.Net I am
I have an asp.net3.5 website.want to deploy this site on iis.After deploy my default
I am working in ASP.NET 3.5 MVC application. We have a functionality where we
I am currently working on an ASP.NET 3.5 and C# web application which deals
I am currently working on an ASP.NET 3.5 and C# web application which deals
I'm developing a multi-threaded ASP.NET 3.5 application, during working with some file, I'm getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.