login控件怎样取username

AlanSmith613 2008-09-22 05:14:30
接手别人做过的一个程序,看他login是用vs自带控件的。只有前台代码:
<%@ Page Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" Title="Wind Hover Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Login ID="Login1" runat="server" DestinationPageUrl ="~/search/Default.aspx"
FailureText="Your login attempt was not successful, please try again!">
<LayoutTemplate>
<table width="350" cellpadding="1" cellspacing="0" style="height:200px; border-right: inactivecaption 1px ridge; border-top: inactivecaption 1px ridge; border-left: inactivecaption 1px ridge; border-bottom: inactivecaption 1px ridge;">
<tr>
<td class="titletextstyle">
<span><strong>LOGIN</strong></span></td>
</tr>
<tr>
<td style="height: 50px" >
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" >UserName:</asp:Label>
<asp:TextBox ID="UserName" runat="server" Height="20px" Width="125px"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="User name is required." ToolTip="User name is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" > Password:</asp:Label>
<asp:TextBox ID="Password" runat="server" TextMode="Password" Height="20px" Width="125px"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td colspan="2" style="height: 20px"></td>
</tr>
<tr>
<td style="color: red">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login"
Text="Login" ValidationGroup="ctl00$Login1" Width="96px" />
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>

</asp:Content>

我想把谁谁登陆的信息,传递到后面的页面,请问怎么写?我想用DestinationPageUrl=="~/search/Default.aspx?Username=....."
请教高手,还有什么其他办法么?
...全文
177 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
AlanSmith613 2008-09-23
  • 打赏
  • 举报
回复
自己顶顶!
Zeteyu 2008-09-22
  • 打赏
  • 举报
回复
有个UserName属性
我姓区不姓区 2008-09-22
  • 打赏
  • 举报
回复

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Login1.UserName == "abc" && Login1.Password == "123")
e.Authenticated = true;
}


XPingguo 2008-09-22
  • 打赏
  • 举报
回复
这些控件用的人可能不多

用form得了
<form method="get" action="/search/Default.aspx">
...
</form>

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧