» »

[C#] Spreminjanje gesla

[C#] Spreminjanje gesla

mmaestro ::

Rab bi spremenil password uporabniku na sledeč način:

MembershipUser user = Membership.GetUser(userName);
user.ChangePassword(user.GetPassword(), txtEditPassword.Text);
Membership.UpdateUser(user);


Vendar mi javi error: This Membership Provider has not been configured to support password retrieval.

Malo sem googlal in videl da je pač treba nastaviti v web.configu enablePasswordRetrieval na true in passwordFormat na Encrypted, kar sem tudi naredil.


Na novo sem ustvaril uporabnike, ker prej sem mel za passwordFormat naštimano Hashed, vendar še vedno ne morem spremeniti gesla.
Kaj naj naredim še? Mi lahko kdo pomaga pri tem.

LP
  • spremenil: mmaestro ()

darkolord ::

a imaš RequiresQuestionAndAnswer mogoče tudi nastavljeno? A nastavljaš nastavitve v web.config za default provider?

mmaestro ::

nastavljeno mam tako:

membership>
providers>
clear/>
add name="AspNetSqlMembershipProvider"
connectionStringName="MembershipConnection"
enablePasswordRetrieval="true"
enablePasswordReset="true"
applicationName="ProgrammersOrganizer"
requiresUniqueEmail="false"
passwordFormat="Encrypted"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
type="System.Web.Security.SqlMembershipProvider" />
/ providers>
/ membership>

< sem odstranil ker drugače mi javlja napake

Zgodovina sprememb…

  • spremenil: mmaestro ()

mmaestro ::

Javi mi napako:
EDIT: Kaj naj naredim, da mi bo delalo?

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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.Provider.ProviderException: 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.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ProviderException: 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.]
System.Web.Security.MembershipProvider.EncryptPassword(Byte[] password) +92
System.Web.Security.MembershipProvider.EncodePassword(String pass, Int32 passwordFormat, String salt) +292
System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +198
System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +391
System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +200
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +650
System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +158
System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +39
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3840


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

Zgodovina sprememb…

  • spremenil: mmaestro ()

darkolord ::

Za encryptanje passworda po defaultu uporablja ključ, ki ga (se mi zdi vsakič) po defaultu sam generira. Da lahko password tudi prebereš potem, ne bo v redu če se ta ključ vmes spremeni, zato moraš v configu nastavit svojega. Tukaj je en prijazen generator ključev


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

ASP.NET + C# vprašanje

Oddelek: Programiranje
342805 (1819) Morenov
»

ASPX preusmeritvena zanka

Oddelek: Programiranje
52127 (2032) Senzacionale
»

[ ASP.NET ] Vprašanje glede podajanja parametrov

Oddelek: Programiranje
151582 (1313) salesky
»

Spreminjanje v DataGrid ---> .NET

Oddelek: Izdelava spletišč
81117 (981) Microsoft
»

[.NET ASP] Napaka : Specified cast is not valid

Oddelek: Programiranje
61134 (1087) pinc

Več podobnih tem