Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / XML

Load Login Page Debug Mode. Save Time.

5.00/5 (1 vote)
6 Nov 2014CPOL 6.1K  
Load login page debug mode. Save time.

As a software developer, it is important to not waste your time. Everytime you launch your app in debug mode for testing and you have to fill your user and your password, it is lost time.

LoginPage.aspx

I wrote this code in order to launch my app without login. You should place it in your Page_Load event in your Login Page code behind. The goal is to simulate the click from the login button.

Code behind in your login page: LoginPage.aspx.cs:

C#
protected void Page_Load(object sender, EventArgs e)
{
  #if DEBUG
    userTextBox.Text = "admin";
    passTextBox.TextMode = InputMode.SingleLine;  //only if TextMode = "password"
    passTextBox.Text = "password1234";
    // more optional code you need to add if mode debug ON
    clickLogin(null, null);
  #endif

 // page load code mode debug OFF .....
}

Controls in your login page. Two textboxes (user and password) and one login button (ImageButton in my case): LoginPage.aspx:

XML
<telerik:RadTextBox runat="server" ID="userTextBox" >
</telerik:RadTextBox>
                                         
<telerik:RadTextBox runat="server" TextMode="Password" ID="passTextBox">
</telerik:RadTextBox>
                                             
<asp:ImageButton  ImageUrl="~/images/btnLogin.gif" ID="btnLogin" runat="server"
OnClick="clickLogin" />

If this post helped you, please leave a comment.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)