ajax-login-system 学习笔记
Skin-LoginStatusControl.ascx
1
<%@ Control Language="C#" ClassName="LoginStatusControl" %>
2
3
<asp:ScriptManagerProxy ID="SMP" runat="Server" />
4
5
<div id="login-status-wrapper">
6
<div id="login-status-bar">
7
Welcome. Please <a href="#sign-in" onclick="_registerControl.Close();_loginControl.Open();" title="Sign In">Sign In</a>.</div>
8
<div id="register_control" style="display: none;" onkeypress="return _registerControl.KeyPressed(event, 'RegisterButton');">
9
<div class="login-form">
10
<div class="form-title"><div class="float-left">Join Community</div><div class="float-right"><small>(<a href="#" onclick="_registerControl.Close();">关闭</a>)</small></div></div>
11
<div class="form-content">
12
<label for="Email-R">Your Email:</label><br />
13
<input type="text" id="Email-R" name="Email-R" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
14
<label for="UserName-R">Screen Name:</label><br />
15
<input type="text" id="UserName-R" name="UserName-R" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
16
<label for="Password-R">Your Password:</label><br />
17
<input type="password" id="Password-R" name="Password-R" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
18
<label for="PasswordCheck-R">Re-enter Password:</label><br />
19
<input type="password" id="PasswordCheck-R" name="PasswordCheck-R" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
20
<input type="checkbox" id="RememberMe-R" name="RememberMe-R" class="checkbox-middle" />
21
<label for="RememberMe-R">Remember me.</label><br />
22
<input type="button" class="button" value="Sign In" id="RegisterButton" name="RegisterButton" onclick="javascript:RegisterClicked();" /><br />
23
<label id="Status-R" class="form-status"></label>
24
</div>
25
</div>
26
</div>
27
<div id="login_control" style="display: none;" onkeypress="return _loginControl.KeyPressed(event, 'LoginButton');">
28
<div class="login-form">
29
<div class="form-title"><div class="float-left">Sign In</div><div class="float-right"><small>(<a href="#" onclick="_loginControl.Close();">关闭</a>)</small></div></div>
30
<div class="form-content">
31
<label for="UserName-L">Your Email:</label><br />
32
<input type="text" id="UserName-L" name="UserName-L" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
33
<label for="Password-L">Your Password:</label><br />
34
<input type="password" id="Password-L" name="Password-L" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />
35
<input type="checkbox" id="RememberMe-L" name="RememberMe-L" class="checkbox-middle" />
36
<label for="RememberMe-L">Remember me.</label><br />
37
<input type="button" class="button" value="Sign In" id="LoginButton" name="LoginButton" onclick="javascript:LoginClicked();" /><br />
38
<div id="Status-L" class="form-status bad"></div>
39
<span class="login-createuser">
40
<a href="#join" onclick="_loginControl.Close(); _registerControl.Open();" title="Create New Account">New Account</a>
41
</span><br />
42
<span class="login-recoverpassword">
43
<a href="#remind-me" onclick="alert('Oops, not yet implemented.');" title="Password Reminder">Password Reminder</a>
44
</span><br />
45
</div>
46
</div>
47
</div>
48
<input type="hidden" value="<%= Page.User.Identity.Name %>" id="server-username" />
49
<input type="hidden" value="<%= Request.IsAuthenticated %>" id="server-auth-status" />
50
</div>
51
52
<script runat="server">
53
54
protected override void OnLoad(EventArgs e)
55
{
56
base.OnLoad(e);
57
this.ConfigureChildControls();
58
}
59
60
protected void ConfigureChildControls()
61
{
62
if (this.SMP != null)
63
{
64
string themeLocation = "~/SnipThemes/default";
65
string authServicePath = base.ResolveUrl("~/AuthenticationService.asmx");
66
67
ServiceReference authServiceReference = new ServiceReference();
68
authServiceReference.Path = authServicePath;
69
this.SMP.Services.Add(authServiceReference);
70
71
ScriptReference shaReference = new ScriptReference();
72
shaReference.Path = base.ResolveUrl(themeLocation + "/scripts/SHA1.js");
73
this.SMP.Scripts.Add(shaReference);
74
75
ScriptReference snipControlsReference = new ScriptReference();
76
snipControlsReference.Path = base.ResolveUrl(themeLocation + "/scripts/SnipControls.js");
77
this.SMP.Scripts.Add(snipControlsReference);
78
79
ScriptReference skinScriptReference = new ScriptReference();
80
skinScriptReference.Path = base.ResolveUrl(themeLocation + "/skins/Skin-LoginStatusControl.js");
81
this.SMP.Scripts.Add(skinScriptReference);
82
}
83
}
84
85
</script>
<%@ Control Language="C#" ClassName="LoginStatusControl" %>2

3
<asp:ScriptManagerProxy ID="SMP" runat="Server" />4

5
<div id="login-status-wrapper">6
<div id="login-status-bar">7
Welcome. Please <a href="#sign-in" onclick="_registerControl.Close();_loginControl.Open();" title="Sign In">Sign In</a>.</div>8
<div id="register_control" style="display: none;" onkeypress="return _registerControl.KeyPressed(event, 'RegisterButton');">9
<div class="login-form">10
<div class="form-title"><div class="float-left">Join Community</div><div class="float-right"><small>(<a href="#" onclick="_registerControl.Close();">关闭</a>)</small></div></div>11
<div class="form-content"> 12
<label for="Email-R">Your Email:</label><br />13
<input type="text" id="Email-R" name="Email-R" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />14
<label for="UserName-R">Screen Name:</label><br />15
<input type="text" id="UserName-R" name="UserName-R" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />16
<label for="Password-R">Your Password:</label><br />17
<input type="password" id="Password-R" name="Password-R" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />18
<label for="PasswordCheck-R">Re-enter Password:</label><br />19
<input type="password" id="PasswordCheck-R" name="PasswordCheck-R" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />20
<input type="checkbox" id="RememberMe-R" name="RememberMe-R" class="checkbox-middle" />21
<label for="RememberMe-R">Remember me.</label><br />22
<input type="button" class="button" value="Sign In" id="RegisterButton" name="RegisterButton" onclick="javascript:RegisterClicked();" /><br />23
<label id="Status-R" class="form-status"></label>24
</div>25
</div>26
</div>27
<div id="login_control" style="display: none;" onkeypress="return _loginControl.KeyPressed(event, 'LoginButton');">28
<div class="login-form">29
<div class="form-title"><div class="float-left">Sign In</div><div class="float-right"><small>(<a href="#" onclick="_loginControl.Close();">关闭</a>)</small></div></div>30
<div class="form-content">31
<label for="UserName-L">Your Email:</label><br />32
<input type="text" id="UserName-L" name="UserName-L" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />33
<label for="Password-L">Your Password:</label><br />34
<input type="password" id="Password-L" name="Password-L" value="" onfocus="this.className='form-focus'" onblur="this.className='form-blur'" /><br />35
<input type="checkbox" id="RememberMe-L" name="RememberMe-L" class="checkbox-middle" />36
<label for="RememberMe-L">Remember me.</label><br /> 37
<input type="button" class="button" value="Sign In" id="LoginButton" name="LoginButton" onclick="javascript:LoginClicked();" /><br />38
<div id="Status-L" class="form-status bad"></div>39
<span class="login-createuser">40
<a href="#join" onclick="_loginControl.Close(); _registerControl.Open();" title="Create New Account">New Account</a>41
</span><br />42
<span class="login-recoverpassword">43
<a href="#remind-me" onclick="alert('Oops, not yet implemented.');" title="Password Reminder">Password Reminder</a>44
</span><br />45
</div>46
</div>47
</div>48
<input type="hidden" value="<%= Page.User.Identity.Name %>" id="server-username" /> 49
<input type="hidden" value="<%= Request.IsAuthenticated %>" id="server-auth-status" /> 50
</div>51

52
<script runat="server">53

54
protected override void OnLoad(EventArgs e)55
{56
base.OnLoad(e);57
this.ConfigureChildControls();58
}59
60
protected void ConfigureChildControls()61
{62
if (this.SMP != null)63
{64
string themeLocation = "~/SnipThemes/default";65
string authServicePath = base.ResolveUrl("~/AuthenticationService.asmx");66
67
ServiceReference authServiceReference = new ServiceReference();68
authServiceReference.Path = authServicePath;69
this.SMP.Services.Add(authServiceReference);70

71
ScriptReference shaReference = new ScriptReference();72
shaReference.Path = base.ResolveUrl(themeLocation + "/scripts/SHA1.js");73
this.SMP.Scripts.Add(shaReference);74

75
ScriptReference snipControlsReference = new ScriptReference();76
snipControlsReference.Path = base.ResolveUrl(themeLocation + "/scripts/SnipControls.js");77
this.SMP.Scripts.Add(snipControlsReference);78

79
ScriptReference skinScriptReference = new ScriptReference();80
skinScriptReference.Path = base.ResolveUrl(themeLocation + "/skins/Skin-LoginStatusControl.js");81
this.SMP.Scripts.Add(skinScriptReference);82
}83
}84

85
</script>


浙公网安备 33010602011771号