Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Web Form cannot access SQl table
Message
From
07/10/2004 11:37:20
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
06/10/2004 18:41:53
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
00948879
Message ID:
00949574
Views:
13
Bob,

Thanks for the help. I am using MSDE. Am I able to create a SQL Server login and grant the ASPNET user rights? If so, how?

Thanks,

Jerry


>Jerry,
>
>It has to do with permissions. Your win form runs as YOU, or I should say as the user account that you logged into windows as. If you are like most people that is either Administrator or equivelent. By default SQL Server (MSDE) sets up a login BUILTIN\Administrators that is in the System Administrator server roll.
>
>So, indirectly your windows user has sa rights to SQL (when you use windows authentication), so does your win forms app.
>
>Web forms are run by the asp.net worker process. This process is set up to run as the ASPNET user or (NT Authority\Network Server on 2003). This user is not by default in the local machine admin group, which means it doesn't have sa rights to SQL Server.
>
>So, you have to go into your SQL Server, create a login that grants localmachinedomain\ASPNET user rights to either the db in question, or on your test machine you can put this sql user into the System Administrator domain.
>
>Another approach would be to put the ASPNET user into the local machine Administrator group.
>
>Finally instead of using trusted connection in your connection string you could use a SQL Server account/password. Alot of devs use sa while developing.
>
>Of course, I won't even get into the issue of developing with a least needed privileges account.
>
>HTH,
>BOb
>
>
>
>>Thanks for the reply. I will try these options you suggested.
>>
>>I think this is strange that my WinForm can query this MSDE table(s) but my WebForm can't.
>>
>>Another strange thing is that both my WinForm and WebForm can query a VFP table in a VFP database.
>>
>>Also, both the MSDE database and VFP database reside on my local drive.
>>
>>Could this be a setting in MSDE? How can I change this?
>>
>>More suggest are welcome.
>>
>>Thanks,
>>
>>Jerry
>>
>>
>>
>>
>>>>I have a SQL Server database residing on my PC. I can successfully query tables in this database from a .Net WinForm. However, if I attempt to perform the same queries using a .Net WebForm, I get the following error message:
>>>>
>>>>--------------
>>>>Server Error in '/myappfolder' Application.
>>>>Login failed for user 'Mydomain\Userid'.
>>>>--------------
>>>>
>>>>Why can I query the SQL Server tables within a WinForm but not within a WebForm?
>>>>
>>>>What can I do to correct this problem?
>>>>
>>>>Thanks,
>>>>
>>>>Jerry
>>>
>>>Jerry;
>>>
>>>Winforms and Webforms are different animals! :)
>>>
>>>Here is something I created after resolving the issues below. There are many types of security and this is only one - perhaps not the "best". I hope something here helps you.
>>>
>>>ASP NET Login Issues for anonymous users
>>>
>>>Problem:
>>>
>>>Error message – Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’.
>>>
>>>Reason:
>>>
>>>IIS not set correctly
>>>
>>>Resolution:
>>>
>>>1.	Open IIS
>>>2.	Go to Default Web Site
>>>3.	Right Click on Web Project of interest
>>>4.	Select Properties
>>>5.	Select Directory Security
>>>6.	Go to “Anonymous access and authentication control”
>>>7.	Select “Edit”
>>>8.	Uncheck “Anonymous access”
>>>9.	Select OK
>>>10.	Select Apply
>>>11.	Select OK
>>>
>>>Problem:
>>>
>>>Error message – Login failed for user ‘(null)’. Reason”: Not associated with a trusted SQL Server connection.
>>>
>>>Reason:
>>>
>>>IIS and/or Web.config may not be set correctly
>>>
>>>Resolution:
>>>
>>>See above to set IIS.
>>>
>>>In the Web.config file add the following line after the <system.web> tag and before the </system> end tag
>>>
>>><identity impersonate = "true"/>
>>>
>>>
>>>Tom
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform