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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:37:59+00:00 2026-05-28T00:37:59+00:00

Is there a way to web protect ASP.NET website so it asks user for

  • 0

Is there a way to web protect ASP.NET website so it asks user for username/password to view?

I’ve been told that this should go in web.config file, but not sure of how to do this, or what should go in there. Any help much 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-28T00:38:00+00:00Added an answer on May 28, 2026 at 12:38 am

    If it is an intranet scenario it’s quite simple. Add this in your web.config

    <configuration>
    <system.web>
    <authentication mode=”Windows”  />
     <authorization>
     <deny users="?"/>
     </authorization>
    </system.web>
    </configuration>
    

    Fastest way for internet applications:

    <authentication mode="Forms"> 
       <forms loginUrl="~/login.aspx"> 
        <credentials> 
         <user name="user" password="password" /> 
         <user name="user2" password="password2" /> 
        </credentials> 
       </forms> 
      </authentication> 
    
      <authorization> 
        <deny users="?"/> 
      </authorization> 
    

    You will also need a new page login.aspx with a form where the user can enter his credentials. On the code behind page you then need the following code:

    string username = textBoxUsername.Text; 
    string password = textBoxPassword.Text; 
    
    if (FormsAuthentication.Authenticate(username, password)) 
        FormsAuthentication.RedirectFromLoginPage(username, false); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to find all web pages that implement a specific master
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding
I have a really simple ASP.NET web application and a web setup project that
I've been experimenting with using mvc-mini-profiler on a ASP.NET website. All of the request
We've inherited an ASP.NET website. We've already converted it to a web application for
We just started a new ASP.Net project that uses web services to serialize some
Is there a way to apply bitmapeffects within a silverlight web project.
Is there a way when creating web services to specify the types to use?
Is there any way for a web application to access the location data of
Is there a way to consume a web service using JavaScript? I'm Looking for

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.