Security Errors trying to fill dataset

A

AndyAFCW

I am developing my first .NET application that connects to a SQL
Server 2000 database and I am having a total nightmare :x :evil:


I am running Windows 2000 with Visual Studio .NET version 7.0.9466,
.NET Framework 1.0.3705 and SQL Server 2000.

I have created a simple table in an SQL database. SQL server includes
ASPNET as a valid login which has unlimited access to all databases,
including the database I have created. The ASPNET account also has
full permissions on the table I have created.

I have then created a simple ASPX that attempts to connect to the
database and fill a dataset with the 3 rows that exist in the SQL
table. The code that should do this is as follows:



Dim objConn As New
SqlConnection("server=Andy;database=TestDB")
Dim strQuery As String = "SELECT * FROM Specification"
Dim dsApplication As New DataSet("Application")

' Get the data
Dim objCmd As New SqlDataAdapter(strQuery, objConn)
objCmd.Fill(dsApplication)



When I run this I get the following error on Line 27:

Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the
required permission please contact your system administrator or
change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Requested
registry access is not allowed.

Source Error:

Line 25: ' Get the data
Line 26: Dim objCmd As New SqlDataAdapter(strQuery, objConn)
Line 27: objCmd.Fill(dsApplication)

I have searched high and low on the web now for over 2 weeks to try
and resolve this to no avail. Most articles suggest the following:

a) Have you given SQL server sufficient permission. Yes I have.

b) Have you updated the web.config file to impersonate an user with
sufficient permissions. Have tried to set it up with the
administrator account for machine as follows:

[code:1:765c675442]
<identity impersonate="true"
userName="ANDY\Administrator" password="xxxxxxxx"
/>
[/code:1:765c675442]


Get the following error:

Parser Error Message: Could not create Windows user token from the
credentials specified in the config file. Error from the operating
system 'A required privilege is not held by the client. '

c) Change the asp.NET user account name in the machine.config
to "SYSTEM". Made no difference.

d) Followed Microsoft's KB article 329291 to Create an event source
under the Application event log in Registry Editor. Made no
difference.

e) Modify the database connection string to explicity name the ASPNET
account, the sa account, the machines Administrator account. None of
them made any difference.


I am completely stuck and if I can't get past this then i'm going to
just dump all the .NET books and Visual Studio .Net and go back to
VB6 and ASP.

Any help or ideas would be very very gratefully received :D [/code]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top