Hi,
I have created a custom membership provider that i use to create certain
types of user accounts that
only require a User Name and Password nothing else this code below works
great if i use the CreateUserWizar d.
But if i try and create the account on my own in code behind i keep getting
a status back of.
"InvalidAns wer" how can i properly handle this status and correct for it.
What needs to be done to make this work correctly.
Code and Web.config below.
<add name="FiPort_Me mbershipProvide rEx"
connectionStrin gName="LocalSql Server"
applicationName ="/"
enablePasswordR etrieval="false "
enablePasswordR eset="true"
requiresQuestio nAndAnswer="fal se"
requiresUniqueE mail="false"
passwordFormat= "Encrypted"
maxInvalidPassw ordAttempts="3"
passwordAttempt Window="10"
minRequiredPass wordLength="8"
minRequiredNona lphanumericChar acters="0"
type="SK.FiPort .DAL.SqlClient. SqlMembershipPr oviderEx, __code"/>
class SqlMembershipPr oviderEx : SqlMembershipPr ovider
{
public override MembershipUser CreateUser(stri ng username, string
password, string email,
string passwordQuestio n, string passwordAnswer, bool isApproved, object
providerUserKey ,
out MembershipCreat eStatus status)
{
if (username.ToLow er() == password.ToLowe r())
{
status = MembershipCreat eStatus.Invalid Password;
return null;
}
else
{
return base.CreateUser (username, password, email,
passwordQuestio n, passwordAnswer, isApproved,
providerUserKey , out status);
}
}
}
protected void btnCreate_Click (object sender, EventArgs e)
{
MembershipProvi der mp =
Membership.Prov iders["FiPort_Members hipProviderEx"];
MembershipCreat eStatus status;
mp.CreateUser(t his.txtServiceP roviderID.Text, this.txtPasswor d.Text,
String.Empty,
String.Empty, String.Empty, true, null, out status);
} 4 7900
Ron,
I don't know what your derived MembershipProvi der class looks like, but the
bottom line is you are deriving from an abstract base class. So you need to
handle the RequiresQuestio n etc. properties to return false by default if
that's the way you want your class to behave.
This link may help: http://msdn.microsoft.com/library/de...ovMod_Prt1.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Ron" wrote:
Hi,
I have created a custom membership provider that i use to create certain
types of user accounts that
only require a User Name and Password nothing else this code below works
great if i use the CreateUserWizar d.
But if i try and create the account on my own in code behind i keep getting
a status back of.
"InvalidAns wer" how can i properly handle this status and correct for it.
What needs to be done to make this work correctly.
Code and Web.config below.
<add name="FiPort_Me mbershipProvide rEx"
connectionStrin gName="LocalSql Server"
applicationName ="/"
enablePasswordR etrieval="false "
enablePasswordR eset="true"
requiresQuestio nAndAnswer="fal se"
requiresUniqueE mail="false"
passwordFormat= "Encrypted"
maxInvalidPassw ordAttempts="3"
passwordAttempt Window="10"
minRequiredPass wordLength="8"
minRequiredNona lphanumericChar acters="0"
type="SK.FiPort .DAL.SqlClient. SqlMembershipPr oviderEx, __code"/>
class SqlMembershipPr oviderEx : SqlMembershipPr ovider
{
public override MembershipUser CreateUser(stri ng username, string
password, string email,
string passwordQuestio n, string passwordAnswer, bool isApproved, object
providerUserKey ,
out MembershipCreat eStatus status)
{
if (username.ToLow er() == password.ToLowe r())
{
status = MembershipCreat eStatus.Invalid Password;
return null;
}
else
{
return base.CreateUser (username, password, email,
passwordQuestio n, passwordAnswer, isApproved,
providerUserKey , out status);
}
}
}
protected void btnCreate_Click (object sender, EventArgs e)
{
MembershipProvi der mp =
Membership.Prov iders["FiPort_Members hipProviderEx"];
MembershipCreat eStatus status;
mp.CreateUser(t his.txtServiceP roviderID.Text, this.txtPasswor d.Text,
String.Empty,
String.Empty, String.Empty, true, null, out status);
}
Hi,
Peter thanks for responding to my question.
What you see is how i have been using the class.
When the CreateUserWizer ed fires its CeratedUser Event my class gets called
and the user is created.
What i am trying to do is gain more control of the creation of the account.
By creating my own form with a button click event that i can control.
Such as validation and other things that i need to happen.
I have tried the following with my provider but still get the same result.
I added these to the class. hoping this would solve it but it gives back a
status
of "InvalidAns wer"
Thanks,
Ron
public override bool ChangePasswordQ uestionAndAnswe r(string username, string
password, string newPasswordQues tion, string newPasswordAnsw er)
{
throw new NotSupportedExc eption();
}
public override string ResetPassword(s tring username, string answer)
{
throw new NotSupportedExc eption();
}
public override bool EnablePasswordR eset
{
get { return base.EnablePass wordReset;}
}
public override bool EnablePasswordR etrieval
{
get{return base.EnablePass wordRetrieval; }
}
public override bool RequiresQuestio nAndAnswer
{
get{return base.RequiresQu estionAndAnswer ;}
}
public override bool RequiresUniqueE mail
{
get{return base.RequiresUn iqueEmail;}
}
"Peter Bromberg [C# MVP]" wrote:
Ron,
I don't know what your derived MembershipProvi der class looks like, but the
bottom line is you are deriving from an abstract base class. So you need to
handle the RequiresQuestio n etc. properties to return false by default if
that's the way you want your class to behave.
This link may help:
http://msdn.microsoft.com/library/de...ovMod_Prt1.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Ron" wrote:
Hi,
I have created a custom membership provider that i use to create certain
types of user accounts that
only require a User Name and Password nothing else this code below works
great if i use the CreateUserWizar d.
But if i try and create the account on my own in code behind i keep getting
a status back of.
"InvalidAns wer" how can i properly handle this status and correct for it.
What needs to be done to make this work correctly.
Code and Web.config below.
<add name="FiPort_Me mbershipProvide rEx"
connectionStrin gName="LocalSql Server"
applicationName ="/"
enablePasswordR etrieval="false "
enablePasswordR eset="true"
requiresQuestio nAndAnswer="fal se"
requiresUniqueE mail="false"
passwordFormat= "Encrypted"
maxInvalidPassw ordAttempts="3"
passwordAttempt Window="10"
minRequiredPass wordLength="8"
minRequiredNona lphanumericChar acters="0"
type="SK.FiPort .DAL.SqlClient. SqlMembershipPr oviderEx, __code"/>
class SqlMembershipPr oviderEx : SqlMembershipPr ovider
{
public override MembershipUser CreateUser(stri ng username, string
password, string email,
string passwordQuestio n, string passwordAnswer, bool isApproved, object
providerUserKey ,
out MembershipCreat eStatus status)
{
if (username.ToLow er() == password.ToLowe r())
{
status = MembershipCreat eStatus.Invalid Password;
return null;
}
else
{
return base.CreateUser (username, password, email,
passwordQuestio n, passwordAnswer, isApproved,
providerUserKey , out status);
}
}
}
protected void btnCreate_Click (object sender, EventArgs e)
{
MembershipProvi der mp =
Membership.Prov iders["FiPort_Members hipProviderEx"];
MembershipCreat eStatus status;
mp.CreateUser(t his.txtServiceP roviderID.Text, this.txtPasswor d.Text,
String.Empty,
String.Empty, String.Empty, true, null, out status);
}
Ron,
Example: "I don't care what the base class does, I want my class to NOT
require password question / answer.":
public override bool RequiresQuestio nAndAnswer
{
get{ return false;}
}
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Ron" wrote:
Hi,
Peter thanks for responding to my question.
What you see is how i have been using the class.
When the CreateUserWizer ed fires its CeratedUser Event my class gets called
and the user is created.
What i am trying to do is gain more control of the creation of the account.
By creating my own form with a button click event that i can control.
Such as validation and other things that i need to happen.
I have tried the following with my provider but still get the same result.
I added these to the class. hoping this would solve it but it gives back a
status
of "InvalidAns wer"
Thanks,
Ron
public override bool ChangePasswordQ uestionAndAnswe r(string username, string
password, string newPasswordQues tion, string newPasswordAnsw er)
{
throw new NotSupportedExc eption();
}
public override string ResetPassword(s tring username, string answer)
{
throw new NotSupportedExc eption();
}
public override bool EnablePasswordR eset
{
get { return base.EnablePass wordReset;}
}
public override bool EnablePasswordR etrieval
{
get{return base.EnablePass wordRetrieval; }
}
public override bool RequiresQuestio nAndAnswer
{
get{return base.RequiresQu estionAndAnswer ;}
}
public override bool RequiresUniqueE mail
{
get{return base.RequiresUn iqueEmail;}
}
"Peter Bromberg [C# MVP]" wrote:
Ron,
I don't know what your derived MembershipProvi der class looks like, but the
bottom line is you are deriving from an abstract base class. So you need to
handle the RequiresQuestio n etc. properties to return false by default if
that's the way you want your class to behave.
This link may help: http://msdn.microsoft.com/library/de...ovMod_Prt1.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Ron" wrote:
Hi,
I have created a custom membership provider that i use to create certain
types of user accounts that
only require a User Name and Password nothing else this code below works
great if i use the CreateUserWizar d.
>
But if i try and create the account on my own in code behind i keep getting
a status back of.
"InvalidAns wer" how can i properly handle this status and correct for it.
>
What needs to be done to make this work correctly.
>
>
Code and Web.config below.
>
<add name="FiPort_Me mbershipProvide rEx"
connectionStrin gName="LocalSql Server"
applicationName ="/"
enablePasswordR etrieval="false "
enablePasswordR eset="true"
requiresQuestio nAndAnswer="fal se"
requiresUniqueE mail="false"
passwordFormat= "Encrypted"
maxInvalidPassw ordAttempts="3"
passwordAttempt Window="10"
minRequiredPass wordLength="8"
minRequiredNona lphanumericChar acters="0"
type="SK.FiPort .DAL.SqlClient. SqlMembershipPr oviderEx, __code"/>
>
>
class SqlMembershipPr oviderEx : SqlMembershipPr ovider
{
>
public override MembershipUser CreateUser(stri ng username, string
password, string email,
string passwordQuestio n, string passwordAnswer, bool isApproved, object
providerUserKey ,
out MembershipCreat eStatus status)
{
if (username.ToLow er() == password.ToLowe r())
{
status = MembershipCreat eStatus.Invalid Password;
return null;
}
else
{
return base.CreateUser (username, password, email,
passwordQuestio n, passwordAnswer, isApproved,
providerUserKey , out status);
>
}
>
>
}
>
}
>
>
protected void btnCreate_Click (object sender, EventArgs e)
{
MembershipProvi der mp =
Membership.Prov iders["FiPort_Members hipProviderEx"];
>
MembershipCreat eStatus status;
>
mp.CreateUser(t his.txtServiceP roviderID.Text, this.txtPasswor d.Text,
String.Empty,
String.Empty, String.Empty, true, null, out status);
>
}
Peter,
Thanks for the link after going thorugh the documnetation agian and
reviewing some chapters in some books. I was able to get it work just as you
posted here.
It seems strange that the documentaion dose not mention that what is in the
web.config dose not matter and that you to have expectitly inform the
provider that the value is false.
Am i safe to assume that my passwords are Encrypted as specifed in the web
config or do i need handle this as well?
You would think that it would use the settings form the config and just do
its job.
Thanks agian for the help.
Ron
"Peter Bromberg [C# MVP]" wrote:
Ron,
Example: "I don't care what the base class does, I want my class to NOT
require password question / answer.":
public override bool RequiresQuestio nAndAnswer
{
get{ return false;}
}
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Ron" wrote:
Hi,
Peter thanks for responding to my question.
What you see is how i have been using the class.
When the CreateUserWizer ed fires its CeratedUser Event my class gets called
and the user is created.
What i am trying to do is gain more control of the creation of the account.
By creating my own form with a button click event that i can control.
Such as validation and other things that i need to happen.
I have tried the following with my provider but still get the same result.
I added these to the class. hoping this would solve it but it gives back a
status
of "InvalidAns wer"
Thanks,
Ron
public override bool ChangePasswordQ uestionAndAnswe r(string username, string
password, string newPasswordQues tion, string newPasswordAnsw er)
{
throw new NotSupportedExc eption();
}
public override string ResetPassword(s tring username, string answer)
{
throw new NotSupportedExc eption();
}
public override bool EnablePasswordR eset
{
get { return base.EnablePass wordReset;}
}
public override bool EnablePasswordR etrieval
{
get{return base.EnablePass wordRetrieval; }
}
public override bool RequiresQuestio nAndAnswer
{
get{return base.RequiresQu estionAndAnswer ;}
}
public override bool RequiresUniqueE mail
{
get{return base.RequiresUn iqueEmail;}
}
"Peter Bromberg [C# MVP]" wrote:
Ron,
I don't know what your derived MembershipProvi der class looks like, but the
bottom line is you are deriving from an abstract base class. So you need to
handle the RequiresQuestio n etc. properties to return false by default if
that's the way you want your class to behave.
This link may help:
> http://msdn.microsoft.com/library/de...ovMod_Prt1.asp
>
Peter
>
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
>
>
>
>
"Ron" wrote:
>
Hi,
I have created a custom membership provider that i use to create certain
types of user accounts that
only require a User Name and Password nothing else this code below works
great if i use the CreateUserWizar d.
But if i try and create the account on my own in code behind i keep getting
a status back of.
"InvalidAns wer" how can i properly handle this status and correct for it.
What needs to be done to make this work correctly.
Code and Web.config below.
<add name="FiPort_Me mbershipProvide rEx"
connectionStrin gName="LocalSql Server"
applicationName ="/"
enablePasswordR etrieval="false "
enablePasswordR eset="true"
requiresQuestio nAndAnswer="fal se"
requiresUniqueE mail="false"
passwordFormat= "Encrypted"
maxInvalidPassw ordAttempts="3"
passwordAttempt Window="10"
minRequiredPass wordLength="8"
minRequiredNona lphanumericChar acters="0"
type="SK.FiPort .DAL.SqlClient. SqlMembershipPr oviderEx, __code"/>
class SqlMembershipPr oviderEx : SqlMembershipPr ovider
{
public override MembershipUser CreateUser(stri ng username, string
password, string email,
string passwordQuestio n, string passwordAnswer, bool isApproved, object
providerUserKey ,
out MembershipCreat eStatus status)
{
if (username.ToLow er() == password.ToLowe r())
{
status = MembershipCreat eStatus.Invalid Password;
return null;
}
else
{
return base.CreateUser (username, password, email,
passwordQuestio n, passwordAnswer, isApproved,
providerUserKey , out status);
}
}
}
protected void btnCreate_Click (object sender, EventArgs e)
{
MembershipProvi der mp =
Membership.Prov iders["FiPort_Members hipProviderEx"];
MembershipCreat eStatus status;
mp.CreateUser(t his.txtServiceP roviderID.Text, this.txtPasswor d.Text,
String.Empty,
String.Empty, String.Empty, true, null, out status);
}
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Graham |
last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider"
that derives from "MembershipProvider". This providor is located in a
Businesslogic layer dll called "Enlighten.LinkMad.Businesslogic". In one of
my frontend websites I use this type to authenticate a user who is trying to
login.
The following excerpt is from the web.config of the particular site showing
the reference to the custom provider, allowing .Net to do...
|
by: Shimon Sim |
last post by:
Hi
I am working on application that need to hold custom user information - Last
and first name, email, some other domain related information.
I used to create Base class for all my pages. The base class would have
CurrentUser property that would hold customer class in session and that was
fine for all my situations.
Now ASP.NET 2.0 came and we have Profile property for pages that could be
extended with configuration to have custom...
|
by: WB |
last post by:
Hi,
I am revamping my company's website with ASP.Net 2.0. In order to use our
existing user data in our SQL 2000, I have written a custom membership
provider. However, when I try to logon with the Login control, it gives an
error:
System.Data.SqlClient.SqlException: Could not find stored procedure
'dbo.aspnet_CheckSchemaVersion'.
Is it because I have not run the aspnet_regsql.exe yet? Do I have to?
|
by: John |
last post by:
Hi
I was working fine with create user wizard and the default membership
provider. I have now customised the membership provider as per attached
web.config. The create user wizard picks up the custom membership provider
fine and removes the security question/answer fields as designated in the
custom provider.
The problem is that when I try to create a new user in the create user
wizard by entering the info and pressing the 'create...
|
by: techsupport |
last post by:
I have some experience with .NET Remoting, as well as ASP.NET 2.0, and
have been wanting to remote a custom membership and profile provider.
I want to take advantage of the new controls in ASP.NET 2.0 such as
Login, Loginuser, Loginview, etc.
The ASP.NET provider model requires entries in the web.config for a
'connectionStringName', which I understand is utilized to connect to
the data source.
Problem is the client machine (machine A)...
| |
by: Axford |
last post by:
Hello,
I am trying to implement my own custom provider for memberships, basically
only id/pwd (no roles). I use the new login web control (I am using asp.net
2.0 and VS2005).
In web.config I followed the examples like:
<membership defaultProvider="AspNetSqlMembershipProvider2">
<providers>
<clear/>
|
by: Mwob |
last post by:
Hi all,
I'm about to start creating a custom membership provider. Its for a
website that already has a table of users in a single table, so I need
to create a custom MP to talk to the data in that table.
In addition, my custom membership provider needs to be able to do this:
1) Hash the password.
2) Verify the strength of the pasword when a user is created. I want to
|
by: alexandis |
last post by:
We have tables of logins (users), that differs much from standard
microsoft structure - we don't use control question/answer, date
fields, etc. But instead we have several additional fields.
I expanded membership class and it works for logging in, but going
further - creating user - I must make following in CreateUserWizard
template:
1) create 'users' record filling standard microsoft fields and ignore
those I don't use (mentioned...
|
by: Sunfire |
last post by:
I need to use a custom database for all of the user membership and rolls.
How do you do this?
|
by: Jonathan Wood |
last post by:
Although this will be a challenge at my level of ASP.NET knowledge, I'm
thinking I should implement my own membership provider class.
Looking over the methods I must implement, a number of questions come to
mind.
1. How would one implement GetNumberOfUsersOnline? I'm not sure where there
is any indication of this? And it this affected by the "Remember me next
time" checkbox, which doesn't seem to work like it does on any other site...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |