温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:BugTrack51aspx汉化改造版V2.1.7
当前文件:
14RFAMJDWSL814/loginnt.aspx[3K,2009-6-12 11:30:42],打开代码结构图
14RFAMJDWSL814/loginnt.aspx[3K,2009-6-12 11:30:42],打开代码结构图1<%@ Page language="C#"%> 2
<!-- 3
Copyright 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
12
DbUtil dbutil; 13
string sql; 14
15
/////////////////////////////////////////////////////////////////////// 16
void 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
/////////////////////////////////////////////////////////////////////// 93
void 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
110
void 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
/////////////////////////////////////////////////////////////////////// 121
void 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 137
Authentication. Please contact your web administrator.</p> 138
139
<p>Windows Integrated Authentication requires that this page (loginNT.aspx) 140
does not permit anonymous access and Windows Integrated Security is selected 141
as 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>







}
