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 8307149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:28:12+00:00 2026-06-08T18:28:12+00:00

I need to save the user name in a sql table, example: an user

  • 0

I need to save the user name in a sql table, example: an user
put it’s user name and password in the login, then, in other form must
send some data in textboxes to another user, how can I save the username?
I’m working in a website with visual studio 2008, c sharp and sql server 2005, thanks
in advance.

this is my code in login and I have to pass the user name to the 2nd form

protected void btnLogin_Click(object sender, EventArgs e)

{
    ClPersona login = new ClPersona();
    bool isAuthenticated = login.sqlLogin1((txtUsuario.Text), (txtPassword.Text));
    if (isAuthenticated)
    {
        //prueba para sesion
        Session["sesionicontrol"] = login.NombreUsuario;
        Response.Redirect("../MENU/menu1.aspx");
    }
  • 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-06-08T18:28:13+00:00Added an answer on June 8, 2026 at 6:28 pm

    Drop a label on your target form like this:

    <asp:label ID="Label1" runat="server" text="Label"></asp:label>    
    

    Go to code behind of the target page find method Page_Load and add following code:

        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = (string) Session["sesionicontrol"];
        }
    

    This will read the value of login.NombreUsuario hich was saved previously into Session["sesionicontrol"] and display it in label.

    Assuptions I made are that:

    1. login.NombreUsuario – contains the data you are reffering as user name – and that’s what you want to pass along.
    2. it is of type string.

    Generally Session privides a dictionary to save any named objects. They are shared between all pages inside current session. You can use session to pass some data across pages like this:

    WebForm1.aspx

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    

    WebForm1.aspx.cs

        protected void Button1_Click(object sender, EventArgs e)
        {
            Session["SomeKey"] = TextBox1.Text;
            Response.Redirect("WebForm2.aspx"); 
        }
    

    This saves the value you have just entered in TextBox into session.

    WebForm2.aspx

    <asp:label ID="Label1" runat="server" text="Label"></asp:label>    
    

    WebForm2.sapx.cs

    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = (string) Session["someKey"];
        }
    }
    

    This fetches the values you have stored in previous page uner key SomeKey and sets it to Label before the page gets rendered. You see the text you have entered on the forst page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project and I need to save user configuration. The
I have an app, and now, I need to save user's preferences. I've done
I need to save to an isolated storage the total time that the user
I need to save the context of the program before exiting ... I've put
I'm trying to save a logged in user's score to my sql database. I
I am developing client-server application in Java which need user login. For that I
I would like to save data in cookies (user name, email address, etc...) but
I have a logging table that stores the user id, date/time, table name, record
.txt file need save in SD-card. Save(n + String.valueOf(key) + .txt); private void Save(String
(sorry for my english) I need save an image in the application path and

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.