Advertisement

08.04.2006 at 06:50AM PDT, ID: 21943421
[x]
Attachment Details

System.Web.UI.HtmlControls.HtmlInputFile - Can't check if junk is typed into text field

Asked by NESupply in C# Programming Language

I have in my C#/asp.net
System.Web.UI.HtmlControls.HtmlInputFile MyFile;

if ((MyFile.PostedFile.ContentLength  == 0) && (MyFile.PostedFile.FileName != ""))
 {
                strFileName = MyFile.PostedFile.FileName;
                FileUploadMsgLB.Text = "An Error occured. Please check the attached file: " + strFileName;
                return;
 }

It works fine,but if the user types junk into the text area (say "asdfg") my catch or If statements don't seem to be triggered and the web just sits there when the submit button is hit.

Funny thing is if the user types junk into the text area(say "c:asdfg" or "c:\asdfg" or "a:asdfg" ...) my catch statement is hit and error label is updated.





Start Free Trial
[+][-]08.04.2006 at 08:38AM PDT, ID: 17250836

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2006 at 08:52AM PDT, ID: 17250978

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Sign Up Now!
Solution Provided By: tokabi
Participating Experts: 2
Solution Grade: C
 
 
 
Loading Advertisement...
20080716-EE-VQP-32