473,326 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Windows authentication bug?

My web.config contains:
<authorization>
<deny users="?" />
</authorization>

<authentication mode="Windows" />
<identity impersonate="true" userName="" password="" />

My connection string in page.aspx.vb contains:

oSQLConn.ConnectionString = "Data Source=" & Server & "," & PortNo &
";Initial Catalog=master;Integrated Security=SSPI;"

When the connection is opened:
oSQLConn.Open()

No matter what I do it always passes anonymous user instead of logged on
user and fails to open the connection. Only if I edit web.config and supply
userName & password

<identity impersonate="true" userName="myname" password="mypassword" />

then the connection is opened with supplied credentials.

Is this a bug? Is there a workaround? Am I missing something?
I'm sure bunch of ppl had to run into this problem. How did you fix it?

Machuga

Mar 30 '07 #1
7 1408


"Machuga" <Ma*****@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
My web.config contains:
<authorization>
<deny users="?" />
</authorization>

<authentication mode="Windows" />
<identity impersonate="true" userName="" password="" />

My connection string in page.aspx.vb contains:

oSQLConn.ConnectionString = "Data Source=" & Server & "," & PortNo
&
";Initial Catalog=master;Integrated Security=SSPI;"

When the connection is opened:
oSQLConn.Open()

No matter what I do it always passes anonymous user instead of logged on
user and fails to open the connection. Only if I edit web.config and
supply
userName & password

<identity impersonate="true" userName="myname" password="mypassword" />

then the connection is opened with supplied credentials.

Is this a bug? Is there a workaround? Am I missing something?
I'm sure bunch of ppl had to run into this problem. How did you fix it?

Machuga
In IIS you need to disable anonymous authentication and make sure integrated
windows authentication is enabled for the virtual directory your application
resides...

HTH,
Mythran

Mar 30 '07 #2
Hi Mythran
Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
string in web.config:

<connectionStrings>
<add name="BUITConnectionString" connectionString="Data
Source=ServerName,2048;Initial Catalog=master;Integrated Security=SSPI"
providerName="System.Data.SqlClient"/>
</connectionStrings>

Then it works fine, but a connection from page in code behind does not.

Thanks for your help
Machuga


"Mythran" wrote:
>
In IIS you need to disable anonymous authentication and make sure integrated
windows authentication is enabled for the virtual directory your application
resides...

HTH,
Mythran

Mar 30 '07 #3
Machuga,
Try changing the IntegratedSecurity property to "none" or "false" ... and
run your code again.

--
Sashidhar Kokku
ikaSystems Corp
"Machuga" wrote:
Hi Mythran
Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
string in web.config:

<connectionStrings>
<add name="BUITConnectionString" connectionString="Data
Source=ServerName,2048;Initial Catalog=master;Integrated Security=SSPI"
providerName="System.Data.SqlClient"/>
</connectionStrings>

Then it works fine, but a connection from page in code behind does not.

Thanks for your help
Machuga


"Mythran" wrote:

In IIS you need to disable anonymous authentication and make sure integrated
windows authentication is enabled for the virtual directory your application
resides...

HTH,
Mythran
Mar 30 '07 #4
Hi Sashidhar,

Your solution gives an expected error:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.

Let me make sure that you understand, that I have a connection string to a
fixed SQL server in web.config that is reading data into a dropdown box
control when page is loaded (that connection works). Upon selection from
dropdown box ( that contains over 500 SQL server names) is passed to a
connection string in code behind page. I have T-SQL code that needs to be
executed on any of those 500 boxes with credentials of a logged in user. That
connection is trying to use anonymous user and fails.
When username and password is supplied in web.config then the connection
works but it uses a that fixed user from web.config instead of logged in user
to connect to the sql boxes.
Thanks for trying
Mchuga

"Sashidhar Kokku" wrote:
Machuga,
Try changing the IntegratedSecurity property to "none" or "false" ... and
run your code again.

--
Sashidhar Kokku
ikaSystems Corp
"Machuga" wrote:
Hi Mythran
Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
string in web.config:

<connectionStrings>
<add name="BUITConnectionString" connectionString="Data
Source=ServerName,2048;Initial Catalog=master;Integrated Security=SSPI"
providerName="System.Data.SqlClient"/>
</connectionStrings>

Then it works fine, but a connection from page in code behind does not.

Thanks for your help
Machuga


"Mythran" wrote:
>
In IIS you need to disable anonymous authentication and make sure integrated
windows authentication is enabled for the virtual directory your application
resides...
>
HTH,
Mythran
>
>
Mar 30 '07 #5
At this point I'm assuming that this is one of those questions that none of
th MVPs want's to touch.
Can anybody point me to the right resource though?
Anything written in all my smart books or found on the web is inconclusive.

I appreciate any help

Thank you
Machuga
Apr 2 '07 #6
See if the info in this resource helps :

http://msdn2.microsoft.com/en-us/library/ms998355.aspx

There's an alternate method at :

http://msdn2.microsoft.com/en-us/library/ms998358.aspx


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Machuga" <Ma*****@discussions.microsoft.comwrote in message
news:5C**********************************@microsof t.com...
At this point I'm assuming that this is one of those questions that none of
th MVPs want's to touch.
Can anybody point me to the right resource though?
Anything written in all my smart books or found on the web is inconclusive.

I appreciate any help

Thank you
Machuga

Apr 2 '07 #7
Thank you Juan for your post.

I've been through those links last week. Everything I got setup is in
accordance with those gudielines.

I noticed that everything on the box that runs IIS and local SQL instance is
authenticating fine. It is when IIS is trying to open connection to a remote
SQL server, thats when authentication is passed as "anonymous". For some
reason it will not carry the credentials of logged in user, but tries to
connect as anonymous.

I'm not sure is this a bug or is this by design.
If it is by design then Microsoft is surley hiding resolution for this
really well, as I have been searching high and low to no avail.

I just can't picture that I'm the only one that needs IIS app. to connect to
a remote SQL server using windows authentication.

Thank you
Machuga

"Juan T. Llibre" wrote:
See if the info in this resource helps :

http://msdn2.microsoft.com/en-us/library/ms998355.aspx

There's an alternate method at :

http://msdn2.microsoft.com/en-us/library/ms998358.aspx


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Machuga" <Ma*****@discussions.microsoft.comwrote in message
news:5C**********************************@microsof t.com...
At this point I'm assuming that this is one of those questions that none of
th MVPs want's to touch.
Can anybody point me to the right resource though?
Anything written in all my smart books or found on the web is inconclusive.

I appreciate any help

Thank you
Machuga


Apr 2 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no...
1
by: sherkozmo | last post by:
I have my SQL 7.0 server set for Mixed security. I see now (finally) the advantages of having windows authentication security for windows groups. I do most of my developing in Access Projects...
4
by: Andrew | last post by:
Hey all, I would like to preface my question by stating I am still learning ASP.net and while I am confident in the basics and foundation, the more advanced stuff is still a challenge. Ok....
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
4
by: Preben Zacho | last post by:
Hi there The scenario I got is this: I have created a Windows application in VS and I want to deploy it to another machine running Windows Vista. Since I have no control over this other machine,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.