Wednesday, August 31, 2005

Regular Expression lookahead, VS bug?

use (?=) as positive look ahead, and (?!) as negative look ahead,
look ahead will not actually match any character, so the string pointer is still unchanged.


for example, I want to match a password in following criteria
(1). at least 7 to 8 long
(2). contain at least one special character @#$
(3). contain at least one digit

(?=.*\d)(?=.*[@#$]).{7,8}

(?=.*\d) will peek if there is at least one digit
(?=.*[@#$]) will peek if there is at least one special char
.{7,8} will check the length.

but unfortunately, I found that I can't use reg exp validator provided by VS, it won't work. Unless I put number and special char in the begining, for example: 13@pass, instead of pass@12

However, if I use a custom validator and pasted the same R.E. into the code behind of the server validator, it works perfectly. So I can easily draw a conclusion that R.E. in VS works totally differently in client side (RE validator) and server side (RE class).

is this a bug?

Monday, August 01, 2005

call external exe from asp.net

looks like a simple task, huh?

I have two applications, one is win app and the other is web app. I had no trouble to call a external PVCS command from win app, but I had HUGE trouble to do the same thing in my web app.

Rationale:
(1). PVCS commond need use windows authentication to establish connection to PVCS server
(2). .Net web application use a weak machine name to run Aspnet_wp.exe
(3). when external command is envoked from web app, it will use that weak name
(4). using impersonate won't help, cause impersonate only apply to web app itself, not external apps

Solution:
(1). change processmodel section in the machine.config, using windows' logon domain/username and its password

drawback:
(1) all web application running in this machine will use your window username and password, because you changed the machine.config

possible alternative
(1). using win32 API "CreateProcessWithLogonW"
or
(2). change configuration in PVCS so that it can take the default weak name of aspnet

still puzzled:
(1). where do I see who's in the owner of a process in windows task manager?

reference:
link