how to Customize Lightswitch beta 2 Login Screen to your Own design (如何定制LS的登录界面)
1. Switch your LightSwitch solution to “File View”
2. Click on Show All Files
3. Right click on the Server Generated project and Add New Item
4. Add the ASPX page called SingIn with the appropriate code.
<form id=”form1″ runat=”server”><div>
<p>Sign in</p> <asp:Label ID=”Label1″ runat=”server” Text=”User Name”></asp:Label> <asp:TextBox ID=”TextBox1″ runat=”server” Width=”128px”></asp:TextBox> <asp:Label ID=”Label2″ runat=”server” Text=”Password”></asp:Label> <asp:TextBox ID=”TextBox2″ runat=”server” TextMode=”Password” Width=”128px”></asp:TextBox> <asp:Button ID=”BtnSingIn” runat=”server” Text=”Sign In” onclick=”BtnSingIn_Click”/> <center><label id=”lblForgot”>Forgot password </label> <a href=”https://www.in4doctor.com” target=”_self”>click here</a></center> </div> </form> |
5- Now we need to write BtnSingIn_Click event:
protected void BtnSingIn_Click(object sender, EventArgs e)
{ Microsoft.LightSwitch.Security.ServerGenerated.Implementation.User user; Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService x = new Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService(); user = x.Login(TextBox1.Text, TextBox2.Text, false, “”); if (user != null) { Response.Write(“<script>window.parent.location=\”http://www.StudentCourse.Com/default.htm\”</script>”); } // you need to change the URL according to your Project } |
6. We now need to get SingIn.aspx to be included in the build output. Right click on your project in solution explorer and select Unload Project.
7. Right click the project and select Edit.
8. Search the file and for default.htm. You should find a section called _BuildFile.
9. Underneath the _BuildFile section for default.htm, add the following.
<_BuildFile Include=”ServerGenerated\Singin.aspx”>
<SubFolder>
</SubFolder>
<PublishType>
</PublishType>
</_BuildFile>
10. Now Insert your login account the and enjoy