Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 space

Author  Topic 

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-06-14 : 11:59:50
How can I search for empty space in the textbox and if it is one i need to display error message. This is for the prevent user the enter filename with space.

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-06-14 : 12:36:07
Add a regular expression validator to the control.
For the Validation Expression, put in something like this:

[A-Za-z0-9/\]{1,30}


Take a look at http://www.regexplib.com/ for more expressions

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-06-14 : 17:13:39
I need this for input type = file text box.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-06-14 : 17:27:53
I don't think you can have validators on that control. You can try, but here again, it's a security thing.

If you are trying to idiot proof that file upload stuff, you are going to need to write a really special ActiveX control. Other than that, you'll have to rely on the "skill" of your users.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-14 : 17:28:37
Is this same question not asked like every week ?

Thats the whole point of security.


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-06-14 : 17:40:00
NoSoSuper,
Let me give you an example so you get an idea of what we are talking about here.

Let's say, I create a page with a Input="file" box on it.
I put some validators on it to force the content to be "c:\yourlistofpasswords.txt" or I could use javascript after the fact to change whatever you entered to whatever file I wanted from your machine.

Basically, the reason you can't "touch" the control is so that a web page can't steal files from your machine without your knowledge.

Make sense??
Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-06-14 : 17:44:11
Yes, thanks MichaelP!
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-14 : 17:49:49
BTW,

If this becomes an activex control the destination must accept a certificate to have the control marked as a safe control.

That seems to be annoying as well...


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-06-14 : 18:57:47
I think you can get a code signing certficate and sign your ActiveX control. That's what we did.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -