Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

ASP.NET / SQL Database Deployment

Ok...  I'm getting frustrated here...  help?

I've developed an ASP.NET website that uses an SQL Server database.  It works awesome in the VS IDE.  I've deployed the website to my own computer, and I'm going to allow access to it within my company network.

So far, the deployment works great:  I can access any ASP.NET webpage that does not have database access.  The ASP.NET code executes as expected and produces the desired results.

However, when I try to access a webpage that access the SQL Server database (on my pc also), I get the following Security Exception:

     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.


What's a poor windows programmer do?  Thx.

0
VBRocks
Asked:
VBRocks
  • 4
  • 4
  • 3
1 Solution
 
tiagosalgadoCommented:
Add this to your web.config
<trust level="Full"/>
0
 
tiagosalgadoCommented:
0
 
VBRocksAuthor Commented:
Where do I add this, anywhere?

     <trust level="Full"/>

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tiagosalgadoCommented:
Under <system.web>
Check this example http://msdn.microsoft.com/en-us/library/tkscy493.aspx
 
0
 
prairiedogCommented:
Is your SQL Server set to "Windows Authentication" mode or mixed mode? You should use the mixed mode for your web application to connect to it.

Right click SQL Server --> Properties -->Security

2008-10-13-122516.jpg
0
 
VBRocksAuthor Commented:
prairiedog - it's set to Mixed Mode.

tiagosalgado - that didn't work.  I'll have to check out the link from your second post.

0
 
prairiedogCommented:
Do you have firewall installed on your PC where the SQL Server installed? If yes, is the port opened?
0
 
VBRocksAuthor Commented:
I have the firewall disabled (windows & kaspersky).

0
 
tiagosalgadoCommented:
0
 
prairiedogCommented:
Does (MachineName)\ASPNET account have access to your SQL Server?
0
 
VBRocksAuthor Commented:
prairiedog - that's exactly it.

I created a different account and gave it Standard permissions. Then went into IIS, to the website properties | Directory Security, and set the UserName and Password to that account.

Works like a charm.

Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now