| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 496 人关注过本帖
标题:[求助] 遇到点问题
只看楼主 加入收藏
ld19821009
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-7-23
收藏
 问题点数:0 回复次数:5 
[求助] 遇到点问题
各位高手们:
我遇到了一个问题:目前我在做一个客服系统,用sqlserver+asp.net(c#)编写的,可是我点击登陆界面点击登陆按钮时,进不了我要去的那个界面,我用的是系统用户名:sa,密码我也设成了sa,可就是点击“登录“按钮没反应,代码是正确的,不知道怎末回事?我很着急,请大家指点迷经!
搜索更多相关主题的帖子: 客服 用户名 
2006-08-03 15:21
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 

不清不楚 說詳細點


[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-08-03 17:14
ld19821009
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-7-23
收藏
得分:0 

恩,我进入登陆界面点击“登陆“按钮没反应,我不知道在sqlserver中怎末设用户名和密码?


以下是登陆界面代码:

namespace CustomerServiceSys.Modules
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;

/// <summary>
/// LogonModule1 的摘要说明。
/// </summary>
public class LogonModule :ModuleBase
{
protected System.Web.UI.WebControls.Label showmsg;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox LogonNameTextBox;
protected System.Web.UI.WebControls.TextBox LogonPasswordTextBox;
protected System.Web.UI.WebControls.Button LoginButton;
protected System.Web.UI.WebControls.Label MismatchLabel;
protected System.Web.UI.WebControls.Image Image1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(HttpContext.Current.User.Identity.IsAuthenticated)
{
String UserName=HttpContext.Current.User.Identity.Name;
String Type=null;
if(UserType.ToString()=="1")
Type="<b><font color='red'>系统管理员</font></b>";
else if(UserType.ToString()=="2")
Type="<b><font color='red'>普通用户</font></b>";
showmsg.Text="<b><font color='red'>"+UserName+"</font></b>,欢迎您进入本系统,用户类型为:"+Type;
showmsg.Style["color"]="Green";
}
else
{
showmsg.Text="您还未登录本系统,登录后才可使用各项服务";
showmsg.Style["color"]="Red";
}

}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void LoginButton_Click(object sender, System.EventArgs e)
{
if(Authenticate(LogonNameTextBox.Text.Trim() ,LogonPasswordTextBox.Text.Trim())==true)
{
FormsAuthentication.SetAuthCookie(LogonNameTextBox.Text.Trim(),false);

Response.Redirect(PathPrefix+"/RecordsMan.aspx");
}
else
{
MismatchLabel.Visible=true;
}
}
}
}




代码是对的,但是我点击“登陆“按钮,进不了“RecordsMan.aspx",是数据库的原因还是什莫原因?我搞不清楚!而且在登陆界面时我就设置了用户名和密码,没设置用户类型这一项,虽说代码中有辨认用户类型代码,但是一旦输入用户名和密码都为sa的话,系统怎末辨认是普通用户还是管理员阿?


2006-08-03 20:02
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 
UserType.ToString()在哪个地方,给值了?
要是没有值的话,你写的那个语句,怎么能辨认呀?

让我们风风火火的过一生,别平平淡淡过一年。
2006-08-04 08:21
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
收藏
得分:0 

webconfig裡面有設置
<authentication mode="Forms">

<forms loginUrl="login.aspx">

<credentials passwordFormat="SHA1">

<user name="user1" password="27CE4CA7FBF00685AF2F617E3F5BBCAFF7B7403C" />

<user name="user2" password="D108F80936F78DFDD333141EBC985B0233A30C7A" />

<user name="user3" password="7BDB09781A3F23885CD43177C0508B375CB1B7E9"/>

</credentials>

</forms>

</authentication>

這些用戶嗎 沒有你怎麼登入的


[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-08-04 09:41
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 
就是呀,有用户是有有用户,可是我怎么没有看见你的UserType的类型呢?
要不然的话,你怎么再下面判断呀?

让我们风风火火的过一生,别平平淡淡过一年。
2006-08-04 10:19
快速回复:[求助] 遇到点问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022621 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved