Click here to Skip to main content
15,891,684 members
Articles / Programming Languages / XML

Load Login Page Debug Mode. Save Time.

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
6 Nov 2014CPOL 5.9K   3   2
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)


Written By
Software Developer (Senior)
Spain Spain
My name is Víctor Sumozas. I am an Industrial engineer and passionate exponent and enthusiast in software development and a keen interest in continuing evolution of .Net technologies. Certificated in Developing ASP.NET 4.5 MVC 4 Web Applications.
You can read the original post at Sumozas Null Pointer
Any comment will be highly appreciated. Thanks!

Comments and Discussions

 
QuestionThanks Pin
Antonio Gago Moledo8-Nov-14 4:19
Antonio Gago Moledo8-Nov-14 4:19 
AnswerRe: Thanks Pin
Víctor Sumozas10-Nov-14 10:04
professionalVíctor Sumozas10-Nov-14 10:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.