views:

40

answers:

1

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?

+2  A: 

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.

Fyodor Soikin