返回首页

这里是我的代码和错误的情况。

我sqlite3的开发与使用Visual Studio ASP.NET 4.0网站和我运行
TechInfoSystems.Data.SQLiteProvider.dll

1.0.66.0 System.Data.SQLite.dll

我刚刚决定,我不能保存用户登录我的数据库中明文密码,所以我现在使用SHA1哈希他们。登录仍然有效,伟大的和单向的十六进制值现在的密码都保存在数据库中,这就是我想要的。

这虽然是需要足够的密码恢复。我把login.aspx页面上重置密码的链接,此链接将带您到ResetPassword.aspx其中包含ASP.NET控制的PasswordRecovery。我改变模板的用户名,问题,和成功的部分,为不同的格式。

现在,用户重定向到ResetPassword.aspx,当用户被提示输入自己的用户名。太棒了!然后点击提交按钮,出现的问题模板要求用户安全问题的答案是什么。太棒了!这里的问题是,如果用户输入的密码不正确,没有显示成功页面,页面坐在他们的处理。 〜20秒后,我看到了一个错误,说数据库被锁定。这里是,确切的错误:
数据库文件被锁定{B​​R}数据库被锁定{B​​R}
说明:执行当前Web请求期间,出现未处理的异常。请检讨有关错误的更多信息,堆栈跟踪,它起源于代码。

异常详细信息:System.Data.SQLite.SQLiteException:数据库文件被锁定{B​​R}数据库被锁定{B​​R}
源错误:

执行当前Web请求期间生成了未处理的异常。有关的起源和异常的位置,可以使用下面的异常堆栈跟踪标识

堆栈跟踪:
[SQLiteException(0X80004005):数据库文件被锁定{B​​R}数据库被锁定]
System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt的)499
System.Data.SQLite.SQLiteDataReader.NextResult()249
System.Data.SQLite.SQLiteDataReader ..构造函数(SQLiteCommand CMD,CommandBehavior的行为)79
System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior行为)38
System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()39
TechInfoSystems.Data.SQLite.SQLiteMembershipProvider.UpdateFailureCount(弦乐用户名,字符串failureType,布尔isAuthenticated)2265
TechInfoSystems.Data.SQLite.SQLiteMembershipProvider.ResetPassword(弦乐用户名,弦乐passwordAnswer)1760
System.Web.Security.MembershipUser.ResetPassword(字符串passwordAnswer)110
System.Web.Security.MembershipUser.ResetPassword(弦乐passwordAnswer useAnswer,布尔,布尔throwOnError)48
System.Web.UI.WebControls.PasswordRecovery.AttemptSendPasswordQuestionView()374
System.Web.UI.WebControls.PasswordRecovery.AttemptSendPassword()77
System.Web.UI.WebControls.PasswordRecovery.OnBubbleEvent(源对象,EventArgs的五)103
& #160; System.Web.UI.Control.RaiseBubbleEvent(源对象,EventArgs的ARGS)37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs的E)125
,弦乐System.Web.UI.WebControls.Button.RaisePostBackEvent(eventArgument)167
& #160; ,弦乐System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(eventArgument)10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl的String eventArgument)13
System.Web.UI.Page.RaisePostBackEvent(POSTDATA的NameValueCollection)36
&# 160; System.Web.UI.Page.ProcessRequestMain(includeStagesBeforeAsyncPoint布尔,布尔includeStagesAfterAsyncPoint)5563
这里是我的代码:

<%@ Page Title="Change Password" Language="C#" MasterPageFile=" /Site.master" AutoEventWireup="true"

    CodeFile="ResetPassword.aspx.cs" Inherits="Account_ChangePassword" %>

 

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <h2>

        Reset Password

    </h2>

                <asp:PasswordRecovery ID="PasswordRecovery" runat="server" Height="104px" Width="409px" Enabled="True" ViewStateMode="Disabled" MembershipProvider="SQLiteMembershipProvider">

                    <MailDefinition IsBodyHtml="True" From="No-Reply@gmail.com" >

 

                    </MailDefinition>

 

                     <UserNameTemplate >

 

                                        <fieldset class="passwordRecovery">

                                            <legend>Password Recovery</legend>

                                        <p>

                                             <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>

                                            <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>

 

                                            <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"

                                                     CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."

                                                    ValidationGroup="PasswordRecovery1">*</asp:RequiredFieldValidator>

                                        </p>

                                            <p>

                                                 <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server"

                                                    CssClass="failureNotification" Height="37px"

                                                    ValidationGroup="PasswordRecovery1" Width="378px" />

                                                <p>

                                                    <br />

                                                </p>

                                            </p>

                                 </fieldset>

                                 <p align="right">

                                 <asp:Button ID="Submit" runat="server" CommandName="Submit" Text="Submit"

                                         ValidationGroup="passwordRecovery" />

                                 </p>

                    </UserNameTemplate>

                    <QuestionTemplate>

                        <table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">

                            <tr>

                                <td>

                                    <table cellpadding="0" style="height:104px;width:409px;">

                                        <tr>

                                            <td align="left" colspan="2">

                                                Identity Confirmation</td>

                                        </tr>

                                        <tr>

                                            <td align="left" colspan="2">

                                                Answer the following question to receive your password.</td>

                                        </tr>

                                        <tr>

                                            <td align="right">

                                                User Name:</td>

                                            <td>

                                                <asp:Literal ID="UserName" runat="server"></asp:Literal>

                                            </td>

                                        </tr>

                                        <tr>

                                            <td align="right">

                                                Question:</td>

                                            <td>

                                                <asp:Literal ID="Question" runat="server"></asp:Literal>

                                            </td>

                                        </tr>

                                        <tr>

                                            <td align="right">

                                                <asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Answer:</asp:Label>

                                            </td>

                                            <td>

                                                <asp:TextBox ID="Answer" runat="server"></asp:TextBox>

                                                <asp:RequiredFieldValidator ID="AnswerRequired" runat="server"

                                                    ControlToValidate="Answer" ErrorMessage="Answer is required."

                                                    ToolTip="Answer is required." ValidationGroup="PasswordRecovery1"

                                                    CssClass="failureNotification">*</asp:RequiredFieldValidator>

                                            </td>

                                        </tr>

                                        <tr>

                                            <td align="left" colspan="2" style="color:Red;">

                                                <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>

                                                <br />

                                                <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server"

                                                    CssClass="failureNotification" Height="37px"

                                                    ValidationGroup="PasswordRecovery1" Width="378px" />

                                            </td>

                                        </tr>

                                        <tr>

                                            <td align="right" colspan="2">

                                                <asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit"

                                                    ValidationGroup="PasswordRecovery1" onclick="SubmitButton_Click" />

                                            </td>

                                        </tr>

                                    </table>

                                </td>

                            </tr>

                        </table>

                    </QuestionTemplate>

                   <SuccessTemplate>

                         <table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">

                             <tr>

                                 <td>

                                     <table cellpadding="0" style="height:104px;width:409px;">

                                         <tr>

                                             <td>

                                                 Your password has been sent to you.</td>

                                         </tr>

                                     </table>

                                 </td>

                             </tr>

                         </table>

                    </SuccessTemplate>

                </asp:PasswordRecovery>

</asp:Content>
如果用户输入正确的安全性问题的答案,用户将看到成功页面,电子邮件,合理调度用户。

我明白,人有SQLite和多线程的问题与通常,这是产生错误,但这个供应商是mimmick,微软,但对于SQLite的作出的SQLprovider。我的意思是,微软必须提供"的PasswordRecovery"。NET控件不应该有任何疑问,导致并发问题。

更新:C#代码嵌入NET控件使用的类,这是幕后执行,所以我无法找出什么样的实际方法,使数据库锁定。我猜其MembershipUser.ResetPassword(passwordAnswer)。我实现了一个onClick方法,回答安全问题,尝试手动重设密码,使用方法,多数民众赞成在它锁定的database.I还试图SQLiteMembershipProvider.ResetPassword()后,也锁定数据库。记住,我没有明确进行数据库查询。净提供者。所以我可以肯定,查询妥善处理。

我很欣赏你的输入,因为我已经看过类似的问题,这种控制,并已发现了什么。

谢谢。 | koolsuccess

回答

评论会员:游客 时间:2012/02/06
我解决了这个自己我必须避免使用PasswordRecovery控制ASP.NET提供。我也不再使用的安全问题/答案。现在,当用户需要他/她的密码重置,所有他们需要做的是输入他们的电子邮件地址,我手动的ResetPassword()//只非重载方法不锁定我的数据库工程。然后我手动给他们发电子邮件的密码,使用他们所提供的电子邮件。C#代码的背后:保护的无效Submit_Click(对象发件人,EventArgs的五){字符串电子邮件EmailTextBox.Text.ToString=() 字符串的用户名=Membership.Providers"SQLiteMembershipProviderGetUserNameByEmail的(电子邮件); 如果(用户名!=NULL){CustomValidator1.IsValid=字符串输入NewPassword="";的MembershipUser亩​​=Membership.Providers["SQLiteMembershipProvider"的GetUser(用户名,FALSE); 如果(亩=NULL) 输入NewPassword=mu.ResetPassword() =新System.Net.Mail.MailMessageSystem.Net.Mail.MailMessage消息() SmtpClientSMTP=新SmtpClient();message.To.Add(xxxxx@xx.com"); message.Subject="您的密码已重置";message.From=新邮件地址之("No-Reply@gmail.com"); message.Body="您的新密码是:"输入NewPassword;message.IsBodyHtml=TRUE;smtp.Host="smtp.gmail.com";smtp.Port=25;smtp.EnableSsl=TRUE;smtp.Credentials=的新System.Net.NetworkCredential("XXXX","XXXXX");smtp.Send(消息);会议["PasswordEmailed的"]=的Response.Redirect("〜/帐号/Login.aspx的",真正的); }其他 {CustomValidator1.IsValid=FALSE;CustomValidator1.DataBind() }}|koolsuccess:拉贾,我看了所有这些链接,不幸的是,他们没有解决的具体问题,我有我更新我的问题,并仍在寻找建议
thatraja
评论会员:游客 时间:2012/02/06
你的问题不包括在你的代码这些检查imgsrc={A}{A2}{A3的}]