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

推荐订阅源

博客园 - Franky
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Spread Privacy
Spread Privacy
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
N
News | PayPal Newsroom
A
Arctic Wolf
NISL@THU
NISL@THU
W
WeLiveSecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
P
Palo Alto Networks Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
L
Lohrmann on Cybersecurity
Last Week in AI
Last Week in AI
T
Threatpost
The Last Watchdog
The Last Watchdog
博客园_首页
C
Cybersecurity and Infrastructure Security Agency CISA
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
S
Security Affairs
P
Privacy & Cybersecurity Law Blog
B
Blog RSS Feed
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
雷峰网
雷峰网
T
Tenable Blog
Schneier on Security
Schneier on Security
H
Heimdal Security Blog
V2EX - 技术
V2EX - 技术
V
V2EX
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
Latest news
Latest news
Help Net Security
Help Net Security
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - 麦子

高级语言程序设计实验大纲 面向对象程序设计实验大纲 参考后原创: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();
    }