B
Ben
Hi,
i have already posted a more or less similar thread but it's gone unsolved
with the flow of the other threads ..
When an anonymous user has created an new account (with the CreateUserWizard
control), i want to let asp.net generate a password and to send it
(AutoGeneratePassword="true") to the address of the email provided by the
new membershipuser in the CreateUserWizard control.
So i defined a custom provider for membership with this code:
web.config:
-----------
<connectionStrings>
<add name="aspnetdb" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated
Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<authentication mode="Forms" />
<membership defaultProvider="MyMembershipProvider">
<providers>
<add name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="aspnetdb"
enablePasswordRetrieval="true"
enablePasswordReset="true"
passwordFormat="Encrypted"
requiresQuestionAndAnswer="true"
applicationName="/"
/>
</providers>
</membership>
code-behind:
------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If User.Identity.IsAuthenticated Then
Dim pw As String
pw = Membership.GetUser.GetPassword.ToString
End If
End Sub
But this generate the error:
"You must specify a non-autogenerated machine key to store passwords in the
encrypted format. Either specify a different passwordFormat, or change the
machineKey configuration to use a non-autogenerated decryption key."
at line "pw = Membership.GetUser.GetPassword.ToString"
Changing in "hashed" is not an option because it's not retrievable and
"clear" is not safe.
So if anyone could explain me how to solve this, it would make my day.
Thanks
Ben
i have already posted a more or less similar thread but it's gone unsolved
with the flow of the other threads ..
When an anonymous user has created an new account (with the CreateUserWizard
control), i want to let asp.net generate a password and to send it
(AutoGeneratePassword="true") to the address of the email provided by the
new membershipuser in the CreateUserWizard control.
So i defined a custom provider for membership with this code:
web.config:
-----------
<connectionStrings>
<add name="aspnetdb" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated
Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<authentication mode="Forms" />
<membership defaultProvider="MyMembershipProvider">
<providers>
<add name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="aspnetdb"
enablePasswordRetrieval="true"
enablePasswordReset="true"
passwordFormat="Encrypted"
requiresQuestionAndAnswer="true"
applicationName="/"
/>
</providers>
</membership>
code-behind:
------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If User.Identity.IsAuthenticated Then
Dim pw As String
pw = Membership.GetUser.GetPassword.ToString
End If
End Sub
But this generate the error:
"You must specify a non-autogenerated machine key to store passwords in the
encrypted format. Either specify a different passwordFormat, or change the
machineKey configuration to use a non-autogenerated decryption key."
at line "pw = Membership.GetUser.GetPassword.ToString"
Changing in "hashed" is not an option because it's not retrievable and
"clear" is not safe.
So if anyone could explain me how to solve this, it would make my day.
Thanks
Ben