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

  • Home
  • SEARCH
  • 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 9270847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:28:18+00:00 2026-06-18T15:28:18+00:00

First off, I am not using Forms Authentication. I found a great tutorial that

  • 0

First off, I am not using Forms Authentication.

I found a great tutorial that almost does what I want:
http://www.codeproject.com/Questions/358434/Keep-me-signed-in-until-Loggged-out

The only problem is that it does not seem like a good idea. It stores the username in the cookie. That seems very bad.

How could I do something like this tutorial but in a safe way?

I essentially just want this basic flow:

if user logged in then show page

User can have the option of being logged in for the session (30 mins of inactivity) or until they choose to explicitly logout.

I have a feeling I will need a session table in my db for this, but I am not sure.

It doesn’t have to be top of the line security since this is for an intranet, but I do still want it to be somewhat safe.

Thanks

  • 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-18T15:28:19+00:00Added an answer on June 18, 2026 at 3:28 pm

    Easiest way is in your Login function, once you have verified them just add:

    FormsAuthentication.SetAuthCookie(theUserName, persistCookieBoolean);
    

    Now you have an authentication cookie set. No encrypting or decrypting needed. Get the username like:

    HttpContext.Current.User.Identity.Name
    

    And see if they are logged in:

    HttpContext.Current.User.Identity.IsAuthenticated
    

    And now you can set authorization easily in the web.config too. Related post: Manual Access control in ASP .Net

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

Sidebar

Related Questions

First off I want to say that I am not using threads or multiple
First, I'll start off by saying that I do not have control over the
First off, I want to say that yes, I do know that doing this
Now, first off, I want to understand whether or not its better to use
First off, I am not very good with MySQL yet, so go easy on
First off, I'm not a coder by profession, just a lowly network engineer :)
First off, I am not a DBA, but I do work in an environment
First off, I'm not an expert with MySQL queries, and I can't seem to
First off, this is NOT a duplicate of: Turn a C string with NULL
First off, I know the title is generic and not fitting. I just couldn't

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.