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”


<center><label id=”lblForgot”>Forgot password </label>

<a href=”https://www.in4doctor.com&#8221; target=”_self”>click here</a></center>



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)



} // 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”>

10. Now Insert your login account  the and enjoy


Jamil Bin Milhem

lightswitch Developer IN4ma Team