Re: Add validation to Login control
- From: Jesse Houwing <Jesse.houwing@xxxxxxxxxxxxxxxx>
- Date: Thu, 2 Aug 2007 14:23:44 +0000 (UTC)
Hello Brian,
Jesse,
I added the password format to my membership provider as follows:
<membership defaultProvider="DSIMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="DSIMembershipProvider"
applicationName="DSI"
type="DSIMembershipProvider"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresUniqueEmail="true"
passwordFormat="\w{6,25}"
/>
</providers>
</membership>
However, when I enter a password of 3 characters.. the ValidateUser
function is still called... shouldn't an error be thrown? Or should I
be catching something in the page load on postback?
I believe it does not by default add the validation logic to the clientside code. That way you can have any format you want. And I don't know if the DSIMembershipProvider even implements the passwordFormat option. It could be that it's just ignoring your configuration directive..
Jesse
"jesse.houwing@xxxxxxxxx" wrote:
Hello Brian,
I want to add my own regular expression validators to the LoginI believe you can set up the expression to use in the web.config in
control so that I can make my users conform to my own custom rules.
However, I do not see a way to do that. Should I just revert to the
1.1 way and create my own text boxes and override the membership
provider? Or is there a better way?
teh memebership provider configuration.
Add an attribute to the membership provider settings in the
web.config named "passwordFormat" and put the regex you want to use
in the value.
Like this:
<membership defaultProvider="MembershipProvider">
<providers>
<clear />
<add
name="MembershipProvider"
applicationName="yourAppName"
connectionStringName="...."
commandTimeout="15"
passwordFormat="^[a-z]+$"
type="MembershipProvider, Security, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=d22f73cb6713ceb0"
/>
</providers>
</membership>
This sample uses a custom written membership provider, so you'll have
to put in your own type information.
Jesse
.
- References:
- Re: Add validation to Login control
- From: Brian Fulford
- Re: Add validation to Login control
- Prev by Date: Re: Add validation to Login control
- Next by Date: Re: Add validation to Login control
- Previous by thread: Re: Add validation to Login control
- Next by thread: Re: Add validation to Login control
- Index(es):
Relevant Pages
|