我有一个包含createuserwizard控件的网站.创建帐户后,验证电子邮件及其验证URL将发送到用户的电子邮件地址.
但是,当我进行测试运行时,单击电子邮件中的URL时会出现此错误:
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Source Error:
Line 17: {
Line 18: //store the user id
*Line 19: Guid userId = new Guid(Request.QueryString["ID"]);*
Line 20:
Error appeared on LINE 19.
Run Code Online (Sandbox Code Playgroud)
另一个有趣的事情是,我的测试运行中的验证URL看起来很奇怪:
http://localhost:4635/WebSite2/Verify.aspx?ID=System.Security.Principal.GenericPrincipal
Run Code Online (Sandbox Code Playgroud)
通常,URL应该是这样的(这是URL末尾的很多字符:
http://localhost:2180/LoginPage/EmailConfirmation.aspx?ID=204696d6-0255-41a7-bb0f-4d7851bf7200
Run Code Online (Sandbox Code Playgroud)
我实际上是在想,它与URL的结尾有一个连接我的错误问题(Guid应该包含32个数字,4个破折号).
生成URL的代码如下:
protected void CreateUserWizard1_SendingMail(object sender,MailMessageEventArgs e)
{
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
string confirmationPage = "/Verify.aspx?ID=" + User.ToString();
string url = domainName + confirmationPage;
e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", url);
}
Run Code Online (Sandbox Code Playgroud)
请给我建议以及我应该怎样做才能解决这个问题.
提前致谢.
更新:
protected void CreateUserWizard1_SendingMail(object sender,MailMessageEventArgs e)
{ …Run Code Online (Sandbox Code Playgroud) “只能将 ScriptManager 的一个实例添加到页面中。” 当我将脚本管理器添加到 AJAX 工具包的密码强度时出现此错误。
我在 createuserwizard 的密码字段旁边添加了密码强度。当这是我网站上唯一的脚本管理器时,为什么会出现此错误?
这是代码:
<asp:TextBox runat="server" ID="Password" TextMode="Password" MaxLength="20" />
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:PasswordStrength ID="Password_PasswordStrength" runat="server"
Enabled="True" TargetControlID="Password" DisplayPosition="RightSide"
StrengthIndicatorType="BarIndicator"
BarBorderCssClass="barBorder"
BarIndicatorCssClass="barInternal">
</asp:PasswordStrength>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator10" ControlToValidate="Password"
ErrorMessage="Password is required." />
</ContentTemplate> </asp:UpdatePanel>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud) 以下代码位于Login.aspx文件中。以前,代码运行非常平稳。但是,添加ajax ModalPopup扩展程序后,会发生此错误。
当用户单击超链接“忘记密码”时,我试图创建一个弹出窗口。
以前,我曾在另一个aspx文件中尝试过ajax日历和Balloonpopup,并且效果很好。仅modalpopup扩展程序有错误。
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.
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
[InvalidOperationException: Extender controls may not be registered before PreRender.]
System.Web.UI.ScriptControlManager.RegisterExtenderControl(TExtenderControl extenderControl, Control targetControl) +442081
Run Code Online (Sandbox Code Playgroud)
这是Login.aspx文件中的代码:
<asp:ScriptManager ID="ScriptManager2" runat="server"> </asp:ScriptManager>
<asp:HyperLink ID="HyperLink2" runat="server">Forget Password</asp:HyperLink>
<asp:ModalPopupExtender ID="HyperLink2_ModalPopupExtender" runat="server"
Enabled="True" TargetControlID="HyperLink2"
PopupControlID="Panel1">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server"> Show pop Up here! </asp:Panel>
Run Code Online (Sandbox Code Playgroud)
我的代码出了什么问题?我将其与互联网上的示例代码进行了比较,这非常相似。
我有一个登录页面.一旦用户成功登录,他们就可以查看和管理他们的个人资料/信息.这可以通过从数据库中检索数据并在formview上显示来完成.
但是,我的userprofile.aspx.cs文件中出现以下错误:
Exception Details: System.IndexOutOfRangeException: An SqlParameter with ParameterName '@UserId' is not contained by this SqlParameterCollection.
Source Error:
Line 44:
Line 45: // Assign the currently logged on user's UserId to the @UserId parameter
Line 46: e.Command.Parameters["@UserId"].Value = currentUserId;
Line 47:
Line 48: }
Run Code Online (Sandbox Code Playgroud)
Userprofile.aspx:
<asp:FormView ID="FormView1" runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="UserId">
<EditItemTemplate>
UserId:
<asp:Label ID="UserIdLabel1" runat="server" Text='<%# Eval("UserId") %>' />
<br />
Password:
<asp:TextBox ID="PasswordTextBox" runat="server"
Text='<%# Bind("Password") %>' />
<br />
Email:
<asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
<br …Run Code Online (Sandbox Code Playgroud) 我是C#编程的新手.
我已将登录控件拖到我的网站上.但是,如果我没有添加任何代码,"记住我"似乎不起作用.
任何人都可以教我如何在c#中实现"记住我"?
我希望它是当用户重新访问网站时,他/她键入用户名文本框,密码将从数据库中检索并显示在密码文本框中,同时将检查记忆复选框.
我一直在研究这个代码是为了好几天,但没有成果.
任何人都可以给我一个教程吗?
迫切想知道它是如何工作的.
希望尽快得到答复.
谢谢.