Asp.net源码专业站
预留广告位
首页->尚未分类->BugTrack51aspx汉化改造版V2.1.7>>loginnt.aspx>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:BugTrack51aspx汉化改造版V2.1.7
当前文件:文件类型 14RFAMJDWSL814/loginnt.aspx[3K,2009-6-12 11:30:42]打开代码结构图
普通视图
		            
1<%@ Page language="C#"%> 2<!-- 3Copyright 2002 Corey Trager 4刘岛 汉化于2006年2月 5--> 6<!-- #include file = "inc.aspx" --> 7<!-- #include file = "inc_logon.aspx" --> 8 9<script language="C#" runat="server"> 10 11 12DbUtil dbutil; 13string sql; 14 15/////////////////////////////////////////////////////////////////////// 16void Page_Load(Object sender, EventArgs e) 17{ 18 dbutil = new DbUtil(); 19 dbutil.get_sqlconnection(); 20 21 Util.do_not_cache(Response); 22 23 // Get authentication mode 24 string auth_mode = Util.get_setting("WindowsAuthentication","0"); 25 26 // If manual authentication only, we shouldn't be here, so redirect to manual screen 27 if (auth_mode == "0") { 28 redirect("default.aspx"); 29 } 30 31 // Get the logon user from IIS 32 string domain_windows_username = Request.ServerVariables["LOGON_USER"]; 33 34 if (domain_windows_username == "") { 35 // If the logon user is blank, then the page is misconfigured 36 // in IIS. Do nothing and let the HTML display. 37 } else { 38 39 // Extract the user name from the logon ID 40 int pos = domain_windows_username.IndexOf("\\") + 1; 41 string windows_username = 42 domain_windows_username.Substring(pos, domain_windows_username.Length-pos); 43 44 // Fetch the user's information from the users table 45 sql = @"select us_id, us_username 46 from users 47 where us_username = '$us' 48 and us_active = 1"; 49 sql = sql.Replace("$us", windows_username); 50 51 DataRow dr = dbutil.get_datarow(sql); 52 if (dr != null) { 53 // The user was found, so bake a cookie and redirect 54 int userid = (int) dr["us_id"]; 55 create_session ( 56 userid, 57 (string) dr["us_username"], 58 "1"); 59 redirect(); 60 } 61 62 // Try fetching the guest user. 63 sql = @"select us_id, us_username 64 from users 65 where us_username = 'guest' 66 and us_active = 1"; 67 68 dr = dbutil.get_datarow(sql); 69 if (dr != null) { 70 // The Guest user was found, so bake a cookie and redirect 71 int userid = (int) dr["us_id"]; 72 create_session ( 73 userid, 74 (string) dr["us_username"], 75 "1"); 76 redirect(); 77 } 78 79 // If using mixed-mode authentication and we got this far, 80 // then we can't sign in using integrated security. Redirect 81 // to the manual screen. 82 if (auth_mode != "1") { 83 redirect("default.aspx?msg=user+not+valid"); 84 } 85 86 // If we are still here, then toss a 401 error. 87 Response.StatusCode = 401; 88 Response.End(); 89 } 90} 91 92/////////////////////////////////////////////////////////////////////// 93void redirect() 94{ 95 96 // redirect to the page the user was going to or start off with bugs.aspx 97 string url = Request["url"]; 98 string qs = Request["qs"]; 99 100 if (url != Request.ServerVariables["URL"]) 101 { 102 Response.Redirect(url + "?" + qs); 103 } 104 else 105 { 106 Response.Redirect("bugs.aspx"); 107 } 108} 109 110void redirect(string url) 111{ 112 //redirect to the url supplied with the original querystring 113 if (url.IndexOf("?") > 0) { 114 Response.Redirect(url + "&" + Request["qs"]); 115 } else { 116 Response.Redirect(url + "?" + Request["qs"]); 117 } 118} 119 120/////////////////////////////////////////////////////////////////////// 121void Page_Unload(Object sender, EventArgs e) 122{ 123 if (dbutil != null) {dbutil.close();} 124} 125 126</script> 127 128<html> 129<head> 130<title>btnet logon</title> 131<link rel="StyleSheet" href="btnet.css" type="text/css"> 132</head> 133<body> 134<h1>Configuration Problem</h1> 135 136<p>This page has not been properly configured for Windows Integrated 137Authentication. Please contact your web administrator.</p> 138 139<p>Windows Integrated Authentication requires that this page (loginNT.aspx) 140does not permit anonymous access and Windows Integrated Security is selected 141as the authentication protocol.</p> 142 143<p><a href="default.aspx?msg=configuration+problem">Go to logon page.</a></p> 144 145</body> 146</html>
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:BugTrack51aspx汉化改造版V2.1.7
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146