Monday, February 20, 2012

Permission denied in ASP.NET 2.0 with IE

When I start my ASP.NET 2.0 Website in VS2005 with XPSP2 I can connect to
the SQL-Express Database without problems
But when I start my Website with Internet Explorer I get the following
error:
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file
C:\CKlein1\App_Data\Ger1_Data.mdf failed. A database with the same name
exists, or specified file cannot be opened, or it is located on UNC share.
SQLExpress runs under NT AUTHORITY/NetworkService and the connection string
in web.config is:
"Data
Source=. \SQLEXPRESS;AttachDbFilename=|DataDirect
ory|\Ger1_Data.mdf;Integrate
d
Security=True;User Instance=False"
1. Why does it work with VS2005 and not with Internet Explorer?
2. How can I set the rigth permission to the daba base?
HelmutI would change tactics here. I would stop using AttachDbFilename. To do so
you simply need to run a one-time script to attach the database to master.
After that, the database remain in place indefinitely . In any case you need
to set the initial catalog in the ConnectionString. See Chapter 9 of my book
for a longer discussion of this issue.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"Helmut Guenther" <q@.2qw.de> wrote in message
news:%23BP2KfOHIHA.4880@.TK2MSFTNGP03.phx.gbl...
> When I start my ASP.NET 2.0 Website in VS2005 with XPSP2 I can connect to
> the SQL-Express Database without problems
> But when I start my Website with Internet Explorer I get the following
> error:
> CREATE DATABASE permission denied in database 'master'.
> An attempt to attach an auto-named database for file
> C:\CKlein1\App_Data\Ger1_Data.mdf failed. A database with the same name
> exists, or specified file cannot be opened, or it is located on UNC share.
> SQLExpress runs under NT AUTHORITY/NetworkService and the connection
> string in web.config is:
> "Data
> Source=. \SQLEXPRESS;AttachDbFilename=|DataDirect
ory|\Ger1_Data.mdf;Integra
ted
> Security=True;User Instance=False"
> 1. Why does it work with VS2005 and not with Internet Explorer?
> 2. How can I set the rigth permission to the daba base?
> Helmut
>

No comments:

Post a Comment