Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3494462
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:00:28+00:00 2026-05-18T12:00:28+00:00

I have a simple ASP.NET page where after the initial page load the user

  • 0

I have a simple ASP.NET page where after the initial page load the user enters a username and a password to two text boxes. Note that I can not use the built-in login control in ASP.NET, as my purpose of using this username and password is slightly different.

Now, I want the user to enter the said two values only once. Afterwards, using those two values I perform several tasks. Now here’s the tricky part; since I set the TextMode property of the password text box to ‘password’, every time a button click occurs it clears the password field, and since every button click event triggers a page load as well, I lose the password data. But I do not want the user to keep entering the password every time he has to click a button.

How can I retain the username and password in my code? If this were a normal .NET Windows Application, I would use a global variable and assign the value the first time and I would have it available to me throughout the life cycle of my program. But how can I do it here?

Please note that this is my very first ASP.NET program, so some code sample would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:00:28+00:00Added an answer on May 18, 2026 at 12:00 pm

    You can use the Session State

    In the session collection you can store and retrieve data for the session to which the user is connected to. A session has a timeout I think its 20 minutes standard.

    'Save
    Session("username") = txtUsername.Text
    Session("password") = txtPassword.Text
    
    'Retrieve
    Response.Write(Session("username"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple ASP.Net page that acts as a front end for
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
I have a simple ASP.NET MVC application, like movie sample. In the list.aspx page
I have this simple ASP.NET page here: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Tree.aspx.cs Inherits=CoconutTree.One %>
I have a simple ASP.NET 3.5 SP1 Web Forms app... I've added the System.Web.Routing
Let's say I have a simple ASP.NET MVC blog application and I want to
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and
I have a really simple ASP.NET web application and a web setup project that
I have created a simple Asp.Net custom control which automatically combines all the correct
I have a simple form with some plain html input like bellow using ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.