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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:33:51+00:00 2026-06-11T19:33:51+00:00

I have a aspx page having 2 textboxes for username and password.At submit button

  • 0

I have a aspx page having 2 textboxes for username and password.At submit button click,it is getting redirect to another page.This page has 2 buttons named “Expire Session” and “Go to profile Page”. Now clicking on second button gets the user to another page where he can see the content of this page.I want when the user click expire session button,the session should be expired and then when user will click on the “Go to profile Page” button,he will be redirected to page but no content will be visible because session is over now.
This is Submit button coding .

 protected void clicked(object sender, System.EventArgs e)
    {
        Session["username"] = textbox_username.Text.ToString();
        Session["password"] = textbox_password.Text.ToString();
        message.Text = "Session saved!";
        textbox_username.Text = null;
        textbox_password.Text = null;
        Response.Redirect("SessionTest.aspx");
    }

I do not know how to expire the session at “Expire Session” button click.I am a newbie.

  • 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-11T19:33:53+00:00Added an answer on June 11, 2026 at 7:33 pm

    Short answer for short question :

    //Destroys the session
    Session.Clear();
    Session.Abandon();
    Response.Redirect("Default.aspx");
    

    Use Session.Clear(); before above code, if you want to clean session values, but with a Session.Abandon(); you will destroy it.

    Check session with

    if(Session["username"] == null) { }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an aspx page with a few textboxes and a submit button. Once
I have an aspx page PopupReference. I am having Tridion control button and few
I have an ASPX page with two RequiredFieldValidator and a button to go to
I have a aspx page that has a UpdatePanel and a asp timer. the
I have an aspx page with two buttons, one of the buttons has an
I am having an aspx page where I have added one asp.net text box
I am having textbox ,combobox & button controls in an aspx page.To add a
I'm having a issue with validations on my aspx page; I have the following
i have default.aspx page and one user control. usercontrol is having following code for
Let's say I have an aspx page with this calendar control: <asp:Calendar ID=Calendar1 runat=server

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.