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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:10:21+00:00 2026-05-19T02:10:21+00:00

I am looking for a very simple solution to password protect an ASP.Net page.

  • 0

I am looking for a very simple solution to password protect an ASP.Net page.

I found exactly what I am looking for here but it is in ASP and I do not know the syntax to convert it to ASP.Net.

It simply creates a temporary cookie that will expire as soon as they close their browser window.

I am not looking to store the username / password in a db. I will manually change the password occasionally.

Simply helping me convert the following code to ASP.Net would be wonderful!

This goes on the logon.aspx page and pulls values from a form.

Username="Administrator"
Password="Admin"
Validated = "OK"

if Strcomp(Request.Form("User"),Username,1)=0 AND Request.Form("password") = Password then
    Response.Cookies("ValidUser") = Validated

    If (Request.QueryString("from")<>"") then
        Response.Redirect Request.QueryString("from")
    else
      Response.Redirect "MyPage.aspx"
    End if    
Else
    If Request.Form("User") <> "" then
        Response.Write "<h3>Authorization Failed.</h3>" & "<br>" & _ "Please try again.<br>&#xa0;<br>"
    End if
End if

This goes on the password protected page to confirm the cookie was created.

Validated = "OK"

if Request.Cookies("ValidUser") <> Validated then
dim s
s = "http://"
s = s & Request.ServerVariables("HTTP_HOST")
s = s & Request.ServerVariables("URL")

if Request.QueryString.Count > 0 THEN
    s = s & "?" & Request.QueryString 
end if

Response.Redirect "Logon.aspx"
End if
  • 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-19T02:10:21+00:00Added an answer on May 19, 2026 at 2:10 am

    Just use the built-in forms authentication and setup your credentials store in the web.config.

    Here’s a quick and dirty example

    Another example

    • 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 problem, but I'm looking for the 'best' solution to
The problem appeared to be very simple, but I can not find any solution
I'm looking for a very simple example of active record in .NET (code samples
I am currently converting a very old, but working classic ASP site to ASP.Net.
I am looking for a very simple solution (using jQuery) to let a small
Short: I am looking for a very simple (configuration/maintenance wise) solution, that would allow
I have a very simple problem and a solution that will work, but I'm
What I'm trying to do is very simple, but I'm looking to do it
Any silverlight text to speech engine available now? I am looking for very simple
I'm looking for a very simple tool to monitor the bandwidth of all my

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.