惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - 麦子

高级语言程序设计实验大纲 面向对象程序设计实验大纲 参考后原创:ASP.NET2.0个性化注册登录系统.rar 关于《ASP.NET2.0网站开发实例教程》中1.1.4 Default.aspx页面的实现的说明 转贴:关于membership实用性讨论 asp.net2.0 站点登录,导航与权限管理,角色及用户信息存储于SQL2000的的方法。 装了VS2005再装IIS的小问题 《 C 语言程序设计》教材中涉及到的常用词汇荟萃 动态网页设计(全)部课件和进度表, C语言程序课件和进度表 03级函授毕业证领取通知 转贴:《ASP.NET2.0开发指南》样单,第1章 ASP.NET 2.0概述 正式入火(10月1日) 电子商务基础课件(10.25更新) 搬家(53天) 准备搬家,乱 装修相片(第50天拍,全部,25号更新) 装修(48天,装修全部价格清单,装好窗帘,晒书) 装修(46天,家具基本上弄好啦) 装修(43天,安装新家具啦)
ASP.NET2.0 自定义CreateUserWizard
麦子 · 2007-05-22 · via 博客园 - 麦子

MSND原文如下:

下面的代码示例使用 CreatedUser 事件将用户姓名存储在个性化属性中。该代码示例需要 Web.config 文件中的下列项。

<configuration>

<system.web>

<profile>

<properties>

<add name="lastName" />

<add name="firstName" />

</properties>

</profile>

</system.web>

</configuration>

 
                
C#  复制代码
<%@ page language="C#"%>
            <script runat="server">
            void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
            {
            Profile.SetPropertyValue("UserName",firstName.Text + " " + lastName.Text);
            }
            </script>
            <html>
            <head runat="server">
            <title>
            CreateUserWizard.CreatedUser sample</title>
            </head>
            <body>
            <form id="form1" runat="server">
            <div>
            <asp:createuserwizard id="CreateUserWizard1" runat="server">
            <wizardsteps>
            <asp:wizardstep runat="server" steptype="Start" title="Identification">
            Tell us your name:<br />
            <table width="100%">
            <tr>
            <td>
            First name:</td>
            <td>
            <asp:textbox id="firstName" runat="server" /></td>
            </tr>
            <tr>
            <td>
            Last name:</td>
            <td>
            <asp:textbox id="lastName" runat="server" /></td>
            </tr>
            </table>
            </asp:wizardstep>
            <asp:createuserwizardstep runat="server" title="Sign Up for Your New Account">
            </asp:createuserwizardstep>
            </wizardsteps>
            </asp:createuserwizard>
            </div>
            </form>
            </body>
            </html>
            


上面加入了一个自定义的wizardstep ,在界面上,可以如下操作:在CreateUserWizard控件上右击,在弹出的菜单上选择“ADD/REMOVE wizardstep”,在出出的界面上单击ADD就可以增加一个wizardstep,用上下箭头把新建的步骤置于中间。

发现按此做,会有些错误;

改正如下:
  1.配置文件中<add name="lastName" /> <add name="firstName" /> 与后面的Profile.SetPropertyValue("UserName",firstName.Text + " " + lastName.Text);  不一致。改正方法1是前者改为.<add name="UserName" />,或者后者改成:Profile.SetPropertyValue("firstName",firstName.Text);Profile.SetPropertyValue("lastName", lastName.Text); 
2.Profile.SetPropertyValue("UserName",firstName.Text + " " + lastName.Text);  后面添加语句Profile.Save(),否则不会保存。
3.配置文件中应允许匿名访问Profile:
<system.web>
      <anonymousIdentification        enabled="true"     />

    <profile >
      <properties >
       <add name="lastName" allowAnonymous="true"/>
        <add name="firstName" allowAnonymous="true"/>
      </properties>
    </profile></system.web>
4.代码应编写在完成注册的按钮下面:
       protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        Profile.SetPropertyValue("firstName", firstName.Text);
        Profile.SetPropertyValue("lastName", lastName.Text);
        Profile.Save();
    }