开发者

How to force username and password entry in C# / VS web app?

开发者 https://www.devze.com 2022-12-28 04:24 出处:网络
I am trying to force user to enter username and password when they run my C#/SQL web application.This was developed in 开发者_开发问答VS 2008 on a 32-bit XP.The current connection string I\'m using in

I am trying to force user to enter username and password when they run my C#/SQL web application. This was developed in 开发者_开发问答VS 2008 on a 32-bit XP. The current connection string I'm using in my web.config file is:

<add name="AdventureWorksConnectionString2" connectionString="Data Source=SIDEKICK;Initial Catalog=AdventureWorks;Persist Security Info=false; " 
        providerName="System.Data.SqlClient" />

But it still doesn't prompt for a username and password. What am I missing?


Not clear what you mean by "enter username and password". I'm going to assume that the browser should pop up a small dialog asking for credentials.

Also, the connection string is missing in your post, so there may be something else I'm missing. Be aware that you can't use "<" and ">" symbols in posts.


So, here's the answer

In your IIS administration, you have to select "Basic Authentication" for your website and remove "Anonymous Access". Open IIS Management, right-click your website, select Properties, then go to "Directory Security" tab, click "Edit" in the "Authentication and Access Control" section.

0

精彩评论

暂无评论...
验证码 换一张
取 消