Wednesday, March 28, 2012

New to MS SQL Server, Need help with Windows Authentication

I am new to the whole ASP .NET scene, so my knowledge is very limited, and if I’m not clear enough please let me know.

I am reading a book published by APress about ASP .NET with C# and I am at the point where I get to begin working with data (fun!!). The problem is that I’m not able to connect to the SQL Server. I have Server 2003 and SQL Server 2005 running on a separate machine than the computer that I use for development – the server is named THESERVER, the SQL server is named THESQLSERVER, and the computer I use for development is my laptop named MYLAPTOP.

So here’s my connection string (I put this in my web.config XML file):

<add name="Pubs" connectionString="DataSource=THESERVER\THESQLSERVER;
Initial Catalog=pubs;Integrated Securit=SSPI"/>

Now here’s what my book reads: For Windows authentication to work, the currently logged-on Windows user must have the required authorization to access the SQL database. This is all it says about Windows authentication because the book assumes that I am running MS SQL Express off localhost.

Questions:

Does the book mean that I will have to add a user to my server for my laptop? If so, how do I log into this user using the connection string?What does it mean by “the current logged-on Windows user”? Is that referring to the user on my laptop, or a user on the server?

I’ve been reading around trying to find more information on exactly how Windows authentication works, but I keep coming up dry. I know that much of this is probably trivial to a lot of you, which is why I am asking because it isn’t to me.

Well, thanks in advance for any help that you can provide me.

<add name="Pubs" connectionString="DataSource=192.168.1.56;
userid=sa; password=mypassword"/>
In the connecting string you need to specify an ip address a user name and password if the SQL
runs in another computer, if you got integrated windows authentication is another story, but I would try with SQL authentication
 
|||

Thanks for the response.

I know that I can do itthis way - using SQL authentication instead - but I was hoping thatthey may be some way of doing it through the Integrated WindowsAuthentication method. The only reason why I want to do it thisway is because of the claim that it is much more secure this way. If anyone can say otherwise and prove that it isn't that much moresecure, that is relatively the same, please tell me :D. That isthe only reason that is holding me back from using th SQLauthentication approach.

Thanks again for the quick response, I really appreciate it.

|||Anyone else with suggestions/solutions?|||Actually setting it to InProc, or ServerState is as secure as SQL Sessin State|||Setting which, MS SQL Server? How do I do that?

No comments:

Post a Comment