如何让用户在注册时填写个人资料部分? (使用提供商)

发布于 2024-10-06 14:52:18 字数 1083 浏览 1 评论 0原文

我试图让用户在注册时填写个人资料选项。我默认使用 asp.net 附带的提供程序。

示例:用户填写此注册表:

Username

Email

Age <- This is what I have tried to add in.

Password

Confirm Password

我通过执行以下操作获得了出现的年龄。

1) 将以下代码添加到 Web.config

  <properties>
    <add name="Word" type="String" />
    <add name="Age" type="Int32" defaultValue="0" />
  </properties>

2) 将以下代码添加到我的 register.aspx 视图中

         <div class="editor-label">
            <%: Html.LabelFor(m => Profile.Age) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(m => Profile.Age)%>
            <%: Html.ValidationMessageFor(m => Profile.Age)%>
        </div>

我去运行它,填写了表单并单击注册。我得到这个:

超时已过。操作完成之前超时时间已过,或者服务器没有响应。

第 127 行:_provider.CreateUser(用户名、密码、电子邮件、null、null、true、null、out status);

这就是我所做的,这可能是完全错误的。最好的方法是什么?

I am trying to let a user fill in profile options when they are registering. I am using the providers that come with asp.net by default.

Example: User fills in this registration form:

Username

Email

Age <- This is what I have tried to add in.

Password

Confirm Password

I got the age to show up by doing the following.

1) Adding the following code to Web.config

  <properties>
    <add name="Word" type="String" />
    <add name="Age" type="Int32" defaultValue="0" />
  </properties>

2) Adding the following code to my register.aspx view

         <div class="editor-label">
            <%: Html.LabelFor(m => Profile.Age) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(m => Profile.Age)%>
            <%: Html.ValidationMessageFor(m => Profile.Age)%>
        </div>

I went to run it, I filled out the form and clicked register. I got this:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

and

Line 127: _provider.CreateUser(userName, password, email, null, null, true, null, out status);

So that's what I have done, which is probably all wrong. What is the best way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人疚 2024-10-13 14:52:18

通过关注我发现的这个维基,我得到了一些东西。

http://wiki.asp.net/page。 aspx/1327/profile-provider-in-aspnet-mvc/

这不是很好,也不是超级初学者友好,但比我发现的其他任何东西都要好。我将配置文件模型与帐户模型分开,因为它在开始时没有明确说明它,但它仍然可以正常工作。

现在我有办法填写个人资料,即使它不是在注册的同时,所以我会将其标记为正确答案。

I got something working by following this wiki I found.

http://wiki.asp.net/page.aspx/1327/profile-provider-in-aspnet-mvc/

It's not great and not super beginner friendly but better than anything else I found. I made the Profile model separate to the account model because it didn't explicitly state it at the start, but it still works alright.

Now I have a way to fill in the profile even if it's not at the same time as registering so I'll mark this as the correct answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文