Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Monday, March 26, 2012

Permissions to view code but not modify (Help)

Hello Everyone,
I am new to SQL 2005 and am trying to setup permissions for the vb .net
programmers.
I want them to be able to look at the stored procedure/view/functions code
but not be able to modify the code.
How can I accomplish this.
Thanks for all the help
ShabnamGrant them VIEW DEFINTION permissions. Either at the server, database, schema or object level.
See ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/151b7a2e-ab97-42ba-baf0-6929c5334e29.htm
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Shabnam Gupta" <sgupta@.evcsolutions.com> wrote in message
news:ePR8IIhFGHA.3056@.TK2MSFTNGP09.phx.gbl...
> Hello Everyone,
> I am new to SQL 2005 and am trying to setup permissions for the vb .net programmers.
> I want them to be able to look at the stored procedure/view/functions code but not be able to
> modify the code.
> How can I accomplish this.
>
> Thanks for all the help
> Shabnam
>sql

Friday, March 23, 2012

Permissions to Deploy and view RS Homepage

I messed up some settings security settings in IIS manager
and due to which I am having trouble with deployment
through VS.NET as well as trouble viewing the Reporting
Services main page.
When I type http://localhost/Reports, I just get the Home
page with Home, My Subscriptions and Help links on the
right top corner. All my reports have dissapeared. Any
tips?Go to properties of Reports and ReportServer virtual roots, open security
tab, select "Edit" under "authentication and access control", then make sure
anonymous in NOT checked. See if this helps.
--
Dmitry Vasilevsky, SQL Server Reporting Services Developer
This posting is provided "AS IS" with no warranties, and confers no rights.
--
---
"Amar Karande" <anonymous@.discussions.microsoft.com> wrote in message
news:24f3d01c4606e$869a6170$a601280a@.phx.gbl...
> I messed up some settings security settings in IIS manager
> and due to which I am having trouble with deployment
> through VS.NET as well as trouble viewing the Reporting
> Services main page.
> When I type http://localhost/Reports, I just get the Home
> page with Home, My Subscriptions and Help links on the
> right top corner. All my reports have dissapeared. Any
> tips?|||It helped. Thanks a bunch.
>--Original Message--
>Go to properties of Reports and ReportServer virtual
roots, open security
>tab, select "Edit" under "authentication and access
control", then make sure
>anonymous in NOT checked. See if this helps.
>--
>Dmitry Vasilevsky, SQL Server Reporting Services
Developer
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>--
>---
>"Amar Karande" <anonymous@.discussions.microsoft.com>
wrote in message
>news:24f3d01c4606e$869a6170$a601280a@.phx.gbl...
>> I messed up some settings security settings in IIS
manager
>> and due to which I am having trouble with deployment
>> through VS.NET as well as trouble viewing the Reporting
>> Services main page.
>> When I type http://localhost/Reports, I just get the
Home
>> page with Home, My Subscriptions and Help links on the
>> right top corner. All my reports have dissapeared. Any
>> tips?
>
>.
>

Tuesday, March 20, 2012

permissions needed for trigger

Using SS2000 SP4. We're using a .NET application. What permissions should be
needed for a user to fire a trigger. Ideally, I wanted the user (userWill) t
o
only have execute permissions on the stored procedures and select permission
s
on the views. But all views, stored procedures and triggers are qualified
with "dbo".
But when I try to update a table and the trigger fires I get these errors:
Server: Msg 229, Level 14, State 5, Line 1
SELECT permission denied on object 'tblFranchiseContacts', database
'SMCLMS_Dan', owner 'dbo'.
Server: Msg 229, Level 14, State 1, Line 1
UPDATE permission denied on object 'tblFranchiseContacts', database
'SMCLMS_Dan', owner 'dbo'.
If I run exec sp_helpdb 'smclms_dan' I get archer\dbober as the owner.
How do I get around this?
Thanks,
--
Dan D.Hi,
You do not need to specify permissions on triggers. Triggers are executed on
UPDATE, INSERT and DELETE statements. So, in order to execute these triggers
users need to have these permissions on the tables holding the triggers non
on the trigger themselves.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Dan D." wrote:

> Using SS2000 SP4. We're using a .NET application. What permissions should
be
> needed for a user to fire a trigger. Ideally, I wanted the user (userWill)
to
> only have execute permissions on the stored procedures and select permissi
ons
> on the views. But all views, stored procedures and triggers are qualified
> with "dbo".
> But when I try to update a table and the trigger fires I get these errors:
> Server: Msg 229, Level 14, State 5, Line 1
> SELECT permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> Server: Msg 229, Level 14, State 1, Line 1
> UPDATE permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> If I run exec sp_helpdb 'smclms_dan' I get archer\dbober as the owner.
> How do I get around this?
> Thanks,
> --
> Dan D.|||Dan,
If the owner of the table and the owner of the sp or view are the same then
the end-user accessing the sp or view does not need to have permissions on
the underlying tables. This provides a security abstraction layer to the
underlying objects. However, if the owners are not the same then you have a
broken ownership chain in which case permissions are required. There are no
execute trigger permissions.
For more information on this, see the security chapter I wrote a while back
in the SQL Server 2000 Operations Guide at:
http://www.microsoft.com/technet/pr...in/sqlops3.mspx
HTH
Jerry
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:056F44C1-5885-423B-A694-64200ECF196B@.microsoft.com...
> Using SS2000 SP4. We're using a .NET application. What permissions should
> be
> needed for a user to fire a trigger. Ideally, I wanted the user (userWill)
> to
> only have execute permissions on the stored procedures and select
> permissions
> on the views. But all views, stored procedures and triggers are qualified
> with "dbo".
> But when I try to update a table and the trigger fires I get these errors:
> Server: Msg 229, Level 14, State 5, Line 1
> SELECT permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> Server: Msg 229, Level 14, State 1, Line 1
> UPDATE permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> If I run exec sp_helpdb 'smclms_dan' I get archer\dbober as the owner.
> How do I get around this?
> Thanks,
> --
> Dan D.|||You need only to set permissions on the sprocs themselves. If the sprocs use
dynamic sql, then the tables need permissions set, too
Jeff
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:056F44C1-5885-423B-A694-64200ECF196B@.microsoft.com...
> Using SS2000 SP4. We're using a .NET application. What permissions should
> be
> needed for a user to fire a trigger. Ideally, I wanted the user (userWill)
> to
> only have execute permissions on the stored procedures and select
> permissions
> on the views. But all views, stored procedures and triggers are qualified
> with "dbo".
> But when I try to update a table and the trigger fires I get these errors:
> Server: Msg 229, Level 14, State 5, Line 1
> SELECT permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> Server: Msg 229, Level 14, State 1, Line 1
> UPDATE permission denied on object 'tblFranchiseContacts', database
> 'SMCLMS_Dan', owner 'dbo'.
> If I run exec sp_helpdb 'smclms_dan' I get archer\dbober as the owner.
> How do I get around this?
> Thanks,
> --
> Dan D.|||Thanks to you all for your replies and help.
--
Dan D.
"Jerry Spivey" wrote:

> Dan,
> If the owner of the table and the owner of the sp or view are the same the
n
> the end-user accessing the sp or view does not need to have permissions on
> the underlying tables. This provides a security abstraction layer to the
> underlying objects. However, if the owners are not the same then you have
a
> broken ownership chain in which case permissions are required. There are
no
> execute trigger permissions.
> For more information on this, see the security chapter I wrote a while bac
k
> in the SQL Server 2000 Operations Guide at:
> [url]http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops3.mspx[/url
]
> HTH
> Jerry
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:056F44C1-5885-423B-A694-64200ECF196B@.microsoft.com...
>
>

Permissions granted from Domain credentials

I am working with Visual Studio.net and creating a front end for a SQL datab
ase. Now with the access front end, it uses the domain credentials of the l
ogged in user to determine what permissions they have for editing records in
the SQL (2000) database.
I need the same to be done with the web front end I am creating now. I have
gone into the WEB.CONFIG file and put in my credentials there, identity i
mpersonate="true" userName="domain\johndoe" password="password"
Now this is ok if...I didn't change my password regularly and I wanted every
one to have full access...but obviously I don't. Is there some syntax that
I need there so that it will use the credentials of the logged in user? Or a
m I in the wrong file and s
hould be making changes elsewhere? I am new to this but I am learning. In
the OleDB connection for the datagrid on the page, I have added the line...
Trusted Connection=SSPI. What am I missing? I am using OleDb connection a
nd OleDb Command. Like I s
aid...with my credential in the web.config, it works fine. But that is only
good for now. I need the security set so when I get to creating a page tha
t only administrators have access to I can get those to work correctly.
Thanks All!!I am assuming that with the Trusted Connection = SSPI the connection is
failing. If so, what error message do you get when it fails?
Rand
This posting is provided "as is" with no warranties and confers no rights.|||You need to allow Kerberos Authentication to occur. The middle machine
must be trusted for Security Delegation. Also , the SQL Server service
account needs to have the Service Principal Name set.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Permissions for tables and Sprocs

Hi everyone,
We are creating a new application in .net and i would like to deny
access of the tables to users, but allow them to perform routines by
stored procedures. I am using Sql2005, and was wondering if anyone had
some knowlegde about this and point me in the right direction? Has
anyone set this up before?
ThanksThis is standard practice. As long as you don't use dynamic SQL in the proce
dures and the procedure
and table has the same owner, then the user only need permissions to the pro
cedures. See
http://www.sommarskog.se/grantperm.html for some elaboration.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166175982.773661.294100@.73g2000cwn.googlegroups.com...
> Hi everyone,
> We are creating a new application in .net and i would like to deny
> access of the tables to users, but allow them to perform routines by
> stored procedures. I am using Sql2005, and was wondering if anyone had
> some knowlegde about this and point me in the right direction? Has
> anyone set this up before?
> Thanks
>|||Tibor Karaszi wrote:
> This is standard practice. As long as you don't use dynamic SQL in the pro
cedures and the procedure
> and table has the same owner, then the user only need permissions to the p
rocedures. See
> http://www.sommarskog.se/grantperm.html for some elaboration.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
Tibor,
Thanks for the quick reply, and i will look at the link you sent. One
problem though, we do use dynamic Sql within some of the sprocs, using
the execute_sql sproc?
Can you explain why this makes a difference?|||> Can you explain why this makes a difference?
that is just the way it is. SQL Server doesn't know what string you are abou
t to execute, so it
cannot allow the user of the proc to "execute just anything" without permiss
ion checking. I.e., a
conscious design decision. See the article, Erland mentions tow ways in 2005
to handle this
(signature and certificate or EXECUTE AS).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166180348.976164.146510@.16g2000cwy.googlegroups.com...
> Tibor Karaszi wrote:
> Tibor,
> Thanks for the quick reply, and i will look at the link you sent. One
> problem though, we do use dynamic Sql within some of the sprocs, using
> the execute_sql sproc?
> Can you explain why this makes a difference?
>|||Tibor,
I have read a couple articles now and feel that Execute As seems to be
the easiest option for the moment, and talks about setting up another
user to execute the code as. With this in mind, some articles say
about assigning this new user to a Role in the database, and th Role is
actually what is assigned the permissions. Do you agree with this?
Also, when they say role, do they mean a database role, or application
role? I am not sure i am understanding the differences between the
two, or why one should be used rather then the other.
Thanks again for all your help so far|||Database roles are containers for database users and other roles. Roles are
commonly used for security because you can grant permissions to the role
once and then control security for individual users using role membership.
Application roles are different beasts. An app role is a database security
context that can be activated in application code using sp_setapprole. Once
activated, it remains in effect until the connection is closed or
sp_unsetapprole is activated. App roles provide a means to elevate
permissions while a user is using an application and prevent direct ad-hoc
database access.
Regarding procedure permissions, like Tibor suggested, normal ownership
chaining works well except when you execute SQL dynamically or need to run
statements that require more permissions. In those cases, you can specify
an alternate security context using certificates or EXECUTE AS. You can
peruse Erland's article for details.
Hope this helps.
Dan Guzman
SQL Server MVP
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166184171.866934.154250@.80g2000cwy.googlegroups.com...
> Tibor,
> I have read a couple articles now and feel that Execute As seems to be
> the easiest option for the moment, and talks about setting up another
> user to execute the code as. With this in mind, some articles say
> about assigning this new user to a Role in the database, and th Role is
> actually what is assigned the permissions. Do you agree with this?
> Also, when they say role, do they mean a database role, or application
> role? I am not sure i am understanding the differences between the
> two, or why one should be used rather then the other.
> Thanks again for all your help so far
>

Permissions for tables and Sprocs

Hi everyone,
We are creating a new application in .net and i would like to deny
access of the tables to users, but allow them to perform routines by
stored procedures. I am using Sql2005, and was wondering if anyone had
some knowlegde about this and point me in the right direction? Has
anyone set this up before?
ThanksThis is standard practice. As long as you don't use dynamic SQL in the procedures and the procedure
and table has the same owner, then the user only need permissions to the procedures. See
http://www.sommarskog.se/grantperm.html for some elaboration.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166175982.773661.294100@.73g2000cwn.googlegroups.com...
> Hi everyone,
> We are creating a new application in .net and i would like to deny
> access of the tables to users, but allow them to perform routines by
> stored procedures. I am using Sql2005, and was wondering if anyone had
> some knowlegde about this and point me in the right direction? Has
> anyone set this up before?
> Thanks
>|||Tibor Karaszi wrote:
> This is standard practice. As long as you don't use dynamic SQL in the procedures and the procedure
> and table has the same owner, then the user only need permissions to the procedures. See
> http://www.sommarskog.se/grantperm.html for some elaboration.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
Tibor,
Thanks for the quick reply, and i will look at the link you sent. One
problem though, we do use dynamic Sql within some of the sprocs, using
the execute_sql sproc?
Can you explain why this makes a difference?|||> Can you explain why this makes a difference?
that is just the way it is. SQL Server doesn't know what string you are about to execute, so it
cannot allow the user of the proc to "execute just anything" without permission checking. I.e., a
conscious design decision. See the article, Erland mentions tow ways in 2005 to handle this
(signature and certificate or EXECUTE AS).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166180348.976164.146510@.16g2000cwy.googlegroups.com...
> Tibor Karaszi wrote:
>> This is standard practice. As long as you don't use dynamic SQL in the procedures and the
>> procedure
>> and table has the same owner, then the user only need permissions to the procedures. See
>> http://www.sommarskog.se/grantperm.html for some elaboration.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
> Tibor,
> Thanks for the quick reply, and i will look at the link you sent. One
> problem though, we do use dynamic Sql within some of the sprocs, using
> the execute_sql sproc?
> Can you explain why this makes a difference?
>|||Tibor,
I have read a couple articles now and feel that Execute As seems to be
the easiest option for the moment, and talks about setting up another
user to execute the code as. With this in mind, some articles say
about assigning this new user to a Role in the database, and th Role is
actually what is assigned the permissions. Do you agree with this?
Also, when they say role, do they mean a database role, or application
role? I am not sure i am understanding the differences between the
two, or why one should be used rather then the other.
Thanks again for all your help so far|||Database roles are containers for database users and other roles. Roles are
commonly used for security because you can grant permissions to the role
once and then control security for individual users using role membership.
Application roles are different beasts. An app role is a database security
context that can be activated in application code using sp_setapprole. Once
activated, it remains in effect until the connection is closed or
sp_unsetapprole is activated. App roles provide a means to elevate
permissions while a user is using an application and prevent direct ad-hoc
database access.
Regarding procedure permissions, like Tibor suggested, normal ownership
chaining works well except when you execute SQL dynamically or need to run
statements that require more permissions. In those cases, you can specify
an alternate security context using certificates or EXECUTE AS. You can
peruse Erland's article for details.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Nemisis" <darrens2005@.hotmail.com> wrote in message
news:1166184171.866934.154250@.80g2000cwy.googlegroups.com...
> Tibor,
> I have read a couple articles now and feel that Execute As seems to be
> the easiest option for the moment, and talks about setting up another
> user to execute the code as. With this in mind, some articles say
> about assigning this new user to a Role in the database, and th Role is
> actually what is assigned the permissions. Do you agree with this?
> Also, when they say role, do they mean a database role, or application
> role? I am not sure i am understanding the differences between the
> two, or why one should be used rather then the other.
> Thanks again for all your help so far
>

Monday, March 12, 2012

Permissions for OleDb to an As400

I have a store procedure written in VB.NET to access an AS400 using System.Data.OleDb. I created the key for the procedure as a .pfx file and before adding the code to access the AS400, I tested it against a SQL Server database and it worked fine. When I added the code to access the AS400, I get the following error:

A .NET Framework error occurred during execution of user defined routine or aggregate 'ap_mapics_Data':

System.Security.SecurityException: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

System.Security.SecurityException:

at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

at System.Security.PermissionSet.Demand()

at System.Data.Common.DbConnectionOptions.DemandPermission()

at System.Data.OleDb.OleDbConnection.PermissionDemand()

at System.Data.OleDb.OleDbConnectionFactory.PermissionDemand(DbConnection outerConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.OleDb.OleDbConnection.Open()

at ProImage_Procedures_Test.StoredProcedures.ap_mapics_Data()

OleDbPermission is only available to assemblies deployed with an UNSAFE CAS permission set grant. Given that your code worked against what is presumably another SQL Server database, I'm guessing that your assembly is deployed with an EXTERNAL_ACCESS grant. If you want more information about the permissions granted at each level, see http://bordecal.mvps.org/Nicole/SqlClrCas/SqlClrCasSpeculations.htm.

Permissions for dll in rssrvpolicy.config

I have built some custom authentication library but have run into a problem.
The custom code uses MySql.Data.dll(a library from MySQL for .NET) to
authenticate users against a MySQL db.
I get an connection error when I attempt to connect and believe that it is
because of CodeGroup permissions that need to be set in the
rssrvpolicy.config file.
I have added a code group as:
<CodeGroup
class="UnionCodeGroup"
version="1"
Name="MySQL"
Description="Code group for the security extension MySQL"
PermissionSetName="FullTrust">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="D:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\MySql.Data.dll"
/>
but still no sucess.
Any ideas? Are there any other security settings?
The server is 2003 with IIS 6.
ThanksI used filemon.exe from SysInternals.com to debug a security
permissions problem with my custom assembly recently. It will show you
if the dll is being loaded and if not, what is preventing it from being
loaded. My solution involved using the file properties - security tab
to compare the allowable user groups on the custom dll to other dll's
in the bin folder.
This may be an obvious question... you have given permission to the
MySQL.Data.dll, but have you given the correct permissions to your
custom dll that uses that library?
I have also seen other posts that comment on the placement of the code
group in the code group heirarchy. Most recommend placing new code
groups right under the root code group node. Let us know what you find.|||Thank so much for your thoughts.
I took your advice and changed the order of the code groups for the DLL's
and it worked. I have the MySQL dll entry followed by custom library.
What is also to be noted is that I did not have to add any entries for the
MySQL dll or my custom dll when I was working on 2000 server with IIS 5.0.
IIS 6.0 has much tighter security.
Problem solved.
Thanks again,
Kevin
<bcsmith@.gmail.com> wrote in message
news:1106250549.705855.130230@.c13g2000cwb.googlegroups.com...
>I used filemon.exe from SysInternals.com to debug a security
> permissions problem with my custom assembly recently. It will show you
> if the dll is being loaded and if not, what is preventing it from being
> loaded. My solution involved using the file properties - security tab
> to compare the allowable user groups on the custom dll to other dll's
> in the bin folder.
> This may be an obvious question... you have given permission to the
> MySQL.Data.dll, but have you given the correct permissions to your
> custom dll that uses that library?
> I have also seen other posts that comment on the placement of the code
> group in the code group heirarchy. Most recommend placing new code
> groups right under the root code group node. Let us know what you find.
>

Friday, March 9, 2012

permissions

Hi,
I am sending parameters to the report from asp.net.
In my aspx pages I have a permission check where I check whether or not the
user can access the page:
Dim myCurrentUser As PnClassLib.currentUser
If IsNothing(Session("currUserObj")) Then
Page.Response.Redirect("../AccessDenied.aspx")
I want to add the above to rss so that if the user didn't login or if he
doesn't have the right permissions he won't be able to view the report.
Is it possible to do that in rss?
ThanksRS supports login permissions directly, so you could just add the
appropriate permissions.
Another thing you could do is to put an Asp.net page in front of the report,
and do the checking/redirecting or call the report from your asp.netpage...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"collie" <collie@.discussions.microsoft.com> wrote in message
news:7EC86BD7-099C-448C-841B-409FA4F7294B@.microsoft.com...
> Hi,
> I am sending parameters to the report from asp.net.
> In my aspx pages I have a permission check where I check whether or not
> the
> user can access the page:
> Dim myCurrentUser As PnClassLib.currentUser
> If IsNothing(Session("currUserObj")) Then
> Page.Response.Redirect("../AccessDenied.aspx")
> I want to add the above to rss so that if the user didn't login or if he
> doesn't have the right permissions he won't be able to view the report.
> Is it possible to do that in rss?
> Thanks
>|||Thanks for the reply.
I am redirecting the user to the report from asp.net. In asp.net I check if
the user logged in and who he is and if he has the right permissions he can
select parameters from asp.net and sent them to the report.
The problem is that anyone can cut and paste the address line in the browser
without first having logged in and be able to view the report.
I need to prevent this from happening.
Is it possible in the report itself to add something like this:
Dim myCurrentUser As PnClassLib.currentUser
If IsNothing(Session("currUserObj")) Then
Page.Response.Redirect("../AccessDenied.aspx")
Thanks
"Wayne Snyder" wrote:
> RS supports login permissions directly, so you could just add the
> appropriate permissions.
> Another thing you could do is to put an Asp.net page in front of the report,
> and do the checking/redirecting or call the report from your asp.netpage...
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "collie" <collie@.discussions.microsoft.com> wrote in message
> news:7EC86BD7-099C-448C-841B-409FA4F7294B@.microsoft.com...
> > Hi,
> >
> > I am sending parameters to the report from asp.net.
> > In my aspx pages I have a permission check where I check whether or not
> > the
> > user can access the page:
> > Dim myCurrentUser As PnClassLib.currentUser
> > If IsNothing(Session("currUserObj")) Then
> > Page.Response.Redirect("../AccessDenied.aspx")
> >
> > I want to add the above to rss so that if the user didn't login or if he
> > doesn't have the right permissions he won't be able to view the report.
> >
> > Is it possible to do that in rss?
> >
> > Thanks
> >
>
>

Wednesday, March 7, 2012

Permission to access dB problem in SQL Server 2005 Express from inside VS2005

I am trying to program a database from inside C++.NET via Visual
Studio 2005 using the ADO.NET set of classes, but this I believe is a
SQL Server 2005 Express permissions question under Windows XP
Professional OS.
In another thread, http://tinyurl.com/373lzx, I was able to open a
database successfully using VS2005 (thanks to a suggestion by Erland
Sommarskog). But subsequent to this I played around with the local
policy permissons while logged in as Administrator and may have
blocked access to this database. How to undo this? (I forgot what I
changed, but at the time it was pretty innocuous, and none of my other
programs have been affected).
Two problems really:
0/ though I can create and access a new database as a Power User, I
cannot access the old database anymore. Literally I have a red 'x'
next to the icon for the old database, and I get the error, under the
Server Explorer of Visual Studio 2005, when I right click "refresh" of
"Exception of the type 'System.Exception' was thrown".
1/ Switching to Administrator is no help (see below for the error),
but that also raises another question (see Q2 below)
2/ I played around with SQL Server 2005 Express Manager,and tried
adding various groups, but to no avail.
Question #1: how to undo this
Question #2: how to add "Admin" as an "object" or whatever you call
it under the SQL Server 2005 Express manager so I avoid the below
error (i.e., so Admin can access this dB).
Thank you.
RL
-
No connection the following error occurred: Unable to open the
physical file "C
\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
\NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
cannot access the file because it is being
used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server
\MSSQL.1
MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
"32(The process canot access the file because it is being used by
another process.)".
Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
login failed.
Login failed for user 'PC_NAME-PC_USER\Administrator'.
File activation failure. The physical file name "C:\Program Files
\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF " may be incorrect.
Press any key to continue . . .
This article may help.
http://support.microsoft.com/kb/313222/en-us
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"raylopez99" wrote:
>I am trying to program a database from inside C++.NET via Visual
> Studio 2005 using the ADO.NET set of classes, but this I believe is a
> SQL Server 2005 Express permissions question under Windows XP
> Professional OS.
> In another thread, http://tinyurl.com/373lzx, I was able to open a
> database successfully using VS2005 (thanks to a suggestion by Erland
> Sommarskog). But subsequent to this I played around with the local
> policy permissons while logged in as Administrator and may have
> blocked access to this database. How to undo this? (I forgot what I
> changed, but at the time it was pretty innocuous, and none of my other
> programs have been affected).
> Two problems really:
> 0/ though I can create and access a new database as a Power User, I
> cannot access the old database anymore. Literally I have a red 'x'
> next to the icon for the old database, and I get the error, under the
> Server Explorer of Visual Studio 2005, when I right click "refresh" of
> "Exception of the type 'System.Exception' was thrown".
> 1/ Switching to Administrator is no help (see below for the error),
> but that also raises another question (see Q2 below)
> 2/ I played around with SQL Server 2005 Express Manager,and tried
> adding various groups, but to no avail.
> Question #1: how to undo this
> Question #2: how to add "Admin" as an "object" or whatever you call
> it under the SQL Server 2005 Express manager so I avoid the below
> error (i.e., so Admin can access this dB).
> Thank you.
> RL
> -
> No connection the following error occurred: Unable to open the
> physical file "C
> \Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
> \NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
> cannot access the file because it is being
> used by another process.)".
> Unable to open the physical file "C:\Program Files\Microsoft SQL Server
> \MSSQL.1
> MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
> "32(The process canot access the file because it is being used by
> another process.)".
> Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
> login failed.
> Login failed for user 'PC_NAME-PC_USER\Administrator'.
> File activation failure. The physical file name "C:\Program Files
> \Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF " may be incorrect.
> Press any key to continue . . .
>
|||On Apr 8, 11:04 am, "Dave Patrick" <DSPatr...@.nospam.gmail.com> wrote:
> This article may help.
> http://support.microsoft.com/kb/313222/en-us
>
Thanks but I was thinking of a less extreme fix.
I'm thinking there must be some way of 'unlocking' the old database.
The reason is, I figured out a workaround, in that I constructed the
same database from scratch, from inside of VS 2005 (i.e. mechanically
reconstructing the entire database), and the new, identical database
can now be accessed as before, from inside VS 2005, and the connection
works (refresh works, 'test connection' from Modify also works, and
the program accessing the new database). But the old database still
has a red "X" next to it, and refreshing does not work.
Just a weird aspect.
I've ordered some books on dB programming and maybe they'll have some
insight, but in general I'd like to know how to reset permissions and/
or fix such problems in the future (short of reconstructing the
database 'from scratch' as I did here)
RL

Permission to access dB problem in SQL Server 2005 Express from inside VS2005

I am trying to program a database from inside C++.NET via Visual
Studio 2005 using the ADO.NET set of classes, but this I believe is a
SQL Server 2005 Express permissions question under Windows XP
Professional OS.
In another thread, http://tinyurl.com/373lzx, I was able to open a
database successfully using VS2005 (thanks to a suggestion by Erland
Sommarskog). But subsequent to this I played around with the local
policy permissons while logged in as Administrator and may have
blocked access to this database. How to undo this? (I forgot what I
changed, but at the time it was pretty innocuous, and none of my other
programs have been affected).
Two problems really:
0/ though I can create and access a new database as a Power User, I
cannot access the old database anymore. Literally I have a red 'x'
next to the icon for the old database, and I get the error, under the
Server Explorer of Visual Studio 2005, when I right click "refresh" of
"Exception of the type 'System.Exception' was thrown".
1/ Switching to Administrator is no help (see below for the error),
but that also raises another question (see Q2 below)
2/ I played around with SQL Server 2005 Express Manager,and tried
adding various groups, but to no avail.
Question #1: how to undo this
Question #2: how to add "Admin" as an "object" or whatever you call
it under the SQL Server 2005 Express manager so I avoid the below
error (i.e., so Admin can access this dB).
Thank you.
RL
-
No connection the following error occurred: Unable to open the
physical file "C
\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
\NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
cannot access the file because it is being
used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server
\MSSQL.1
MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
"32(The process canot access the file because it is being used by
another process.)".
Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
login failed.
Login failed for user 'PC_NAME-PC_USER\Administrator'.
File activation failure. The physical file name "C:\Program Files
\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF" may be incorrect.
Press any key to continue . . .This article may help.
http://support.microsoft.com/kb/313222/en-us
--
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"raylopez99" wrote:
>I am trying to program a database from inside C++.NET via Visual
> Studio 2005 using the ADO.NET set of classes, but this I believe is a
> SQL Server 2005 Express permissions question under Windows XP
> Professional OS.
> In another thread, http://tinyurl.com/373lzx, I was able to open a
> database successfully using VS2005 (thanks to a suggestion by Erland
> Sommarskog). But subsequent to this I played around with the local
> policy permissons while logged in as Administrator and may have
> blocked access to this database. How to undo this? (I forgot what I
> changed, but at the time it was pretty innocuous, and none of my other
> programs have been affected).
> Two problems really:
> 0/ though I can create and access a new database as a Power User, I
> cannot access the old database anymore. Literally I have a red 'x'
> next to the icon for the old database, and I get the error, under the
> Server Explorer of Visual Studio 2005, when I right click "refresh" of
> "Exception of the type 'System.Exception' was thrown".
> 1/ Switching to Administrator is no help (see below for the error),
> but that also raises another question (see Q2 below)
> 2/ I played around with SQL Server 2005 Express Manager,and tried
> adding various groups, but to no avail.
> Question #1: how to undo this
> Question #2: how to add "Admin" as an "object" or whatever you call
> it under the SQL Server 2005 Express manager so I avoid the below
> error (i.e., so Admin can access this dB).
> Thank you.
> RL
> -
> No connection the following error occurred: Unable to open the
> physical file "C
> \Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
> \NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
> cannot access the file because it is being
> used by another process.)".
> Unable to open the physical file "C:\Program Files\Microsoft SQL Server
> \MSSQL.1
> MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
> "32(The process canot access the file because it is being used by
> another process.)".
> Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
> login failed.
> Login failed for user 'PC_NAME-PC_USER\Administrator'.
> File activation failure. The physical file name "C:\Program Files
> \Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF" may be incorrect.
> Press any key to continue . . .
>|||On Apr 8, 11:04 am, "Dave Patrick" <DSPatr...@.nospam.gmail.com> wrote:
> This article may help.
> http://support.microsoft.com/kb/313222/en-us
>
Thanks but I was thinking of a less extreme fix.
I'm thinking there must be some way of 'unlocking' the old database.
The reason is, I figured out a workaround, in that I constructed the
same database from scratch, from inside of VS 2005 (i.e. mechanically
reconstructing the entire database), and the new, identical database
can now be accessed as before, from inside VS 2005, and the connection
works (refresh works, 'test connection' from Modify also works, and
the program accessing the new database). But the old database still
has a red "X" next to it, and refreshing does not work.
Just a weird aspect.
I've ordered some books on dB programming and maybe they'll have some
insight, but in general I'd like to know how to reset permissions and/
or fix such problems in the future (short of reconstructing the
database 'from scratch' as I did here)
RL

Permission to access dB problem in SQL Server 2005 Express from inside VS2005

I am trying to program a database from inside C++.NET via Visual
Studio 2005 using the ADO.NET set of classes, but this I believe is a
SQL Server 2005 Express permissions question under Windows XP
Professional OS.
In another thread, http://tinyurl.com/373lzx, I was able to open a
database successfully using VS2005 (thanks to a suggestion by Erland
Sommarskog). But subsequent to this I played around with the local
policy permissons while logged in as Administrator and may have
blocked access to this database. How to undo this? (I forgot what I
changed, but at the time it was pretty innocuous, and none of my other
programs have been affected).
Two problems really:
0/ though I can create and access a new database as a Power User, I
cannot access the old database anymore. Literally I have a red 'x'
next to the icon for the old database, and I get the error, under the
Server Explorer of Visual Studio 2005, when I right click "refresh" of
"Exception of the type 'System.Exception' was thrown".
1/ Switching to Administrator is no help (see below for the error),
but that also raises another question (see Q2 below)
2/ I played around with SQL Server 2005 Express Manager,and tried
adding various groups, but to no avail.
Question #1: how to undo this
Question #2: how to add "Admin" as an "object" or whatever you call
it under the SQL Server 2005 Express manager so I avoid the below
error (i.e., so Admin can access this dB).
Thank you.
RL
-
No connection the following error occurred: Unable to open the
physical file "C
\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
\NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
cannot access the file because it is being
used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server
\MSSQL.1
MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
"32(The process canot access the file because it is being used by
another process.)".
Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
login failed.
Login failed for user 'PC_NAME-PC_USER\Administrator'.
File activation failure. The physical file name "C:\Program Files
\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF" may be incorrect.
Press any key to continue . . .This article may help.
http://support.microsoft.com/kb/313222/en-us
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"raylopez99" wrote:
>I am trying to program a database from inside C++.NET via Visual
> Studio 2005 using the ADO.NET set of classes, but this I believe is a
> SQL Server 2005 Express permissions question under Windows XP
> Professional OS.
> In another thread, http://tinyurl.com/373lzx, I was able to open a
> database successfully using VS2005 (thanks to a suggestion by Erland
> Sommarskog). But subsequent to this I played around with the local
> policy permissons while logged in as Administrator and may have
> blocked access to this database. How to undo this? (I forgot what I
> changed, but at the time it was pretty innocuous, and none of my other
> programs have been affected).
> Two problems really:
> 0/ though I can create and access a new database as a Power User, I
> cannot access the old database anymore. Literally I have a red 'x'
> next to the icon for the old database, and I get the error, under the
> Server Explorer of Visual Studio 2005, when I right click "refresh" of
> "Exception of the type 'System.Exception' was thrown".
> 1/ Switching to Administrator is no help (see below for the error),
> but that also raises another question (see Q2 below)
> 2/ I played around with SQL Server 2005 Express Manager,and tried
> adding various groups, but to no avail.
> Question #1: how to undo this
> Question #2: how to add "Admin" as an "object" or whatever you call
> it under the SQL Server 2005 Express manager so I avoid the below
> error (i.e., so Admin can access this dB).
> Thank you.
> RL
> -
> No connection the following error occurred: Unable to open the
> physical file "C
> \Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
> \NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
> cannot access the file because it is being
> used by another process.)".
> Unable to open the physical file "C:\Program Files\Microsoft SQL Server
> \MSSQL.1
> MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
> "32(The process canot access the file because it is being used by
> another process.)".
> Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
> login failed.
> Login failed for user 'PC_NAME-PC_USER\Administrator'.
> File activation failure. The physical file name "C:\Program Files
> \Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF" may be incorrect.
> Press any key to continue . . .
>|||On Apr 8, 11:04 am, "Dave Patrick" <DSPatr...@.nospam.gmail.com> wrote:
> This article may help.
> http://support.microsoft.com/kb/313222/en-us
>
Thanks but I was thinking of a less extreme fix.
I'm thinking there must be some way of 'unlocking' the old database.
The reason is, I figured out a workaround, in that I constructed the
same database from scratch, from inside of VS 2005 (i.e. mechanically
reconstructing the entire database), and the new, identical database
can now be accessed as before, from inside VS 2005, and the connection
works (refresh works, 'test connection' from Modify also works, and
the program accessing the new database). But the old database still
has a red "X" next to it, and refreshing does not work.
Just a weird aspect.
I've ordered some books on dB programming and maybe they'll have some
insight, but in general I'd like to know how to reset permissions and/
or fix such problems in the future (short of reconstructing the
database 'from scratch' as I did here)
RL

Saturday, February 25, 2012

Permission problem

Windows 2000 server, service pack 4, RAID 5 array, 2Gb RAM, SQL server 2000.

.Net framework 1.1 installed and runs happily UNTIL you try to access anything to do with data.

I've got a c# page, imported all relevent namespaces etc. This runs fine on other servers and my XP Pro machine. However, when put on this server, all I get is

Exception Details: System.UnauthorizedAccessException: Access is denied.

I've tried explictly setting permissions on the file, directory etc, but nothing I've found can get the file to work, yet other c# pages which don't use SQL connections work fine !

The offending line:

Line 31: SqlCommand sqlCmd = new SqlCommand(sql,sqlCon);
Line 32: sqlCon.Open();
Line 33: SqlDataReader datareader = sqlCmd.ExecuteReader();
Line 34: while (datareader.Read()

is line 32.

STACK TRACE:

[UnauthorizedAccessException: Access is denied.]
System.EnterpriseServices.Platform.Initialize() +497
System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb) +11
System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl) +797
System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl) +170
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +356
System.Data.SqlClient.SqlConnection.Open() +384
ASP.test_aspx.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\fishfood\test.aspx:32
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

I've copied this directory and set up another application on another server and it works fine!

Anyone got any ideas?What does your Connection string look like. Is it set up with the correct:

SERVER
PWD
UID
DATABASE

..for this particular server. You haven't by any chance forgotton to change it when deploying your application to server?|||Connection string is fine;

Persist Security Info=False;Data Source=x.x.x.x;Initial Catalog=xxxxxx;User ID=xxxxxx;Password=xxxxxx;"

I tried harding it into the page and using it in the web.config file - makes no difference|||I'm having this exact same problem (except in VB, instead of C#). On my development PC, I'm running W2K Pro, IIS 5, SQL2K Personal Edition, .net Framework v1.1 and I get the error below. But I can execute that exact same page on 2 different remote servers. One is W2K Server with IIS 5 and SQL2K Standard with .net framework v1.1. The other is a W2K3 server with IIS 6 and SQL2K Standard with .net framework v1.1.

Each SQL Server is running in Mixed mode. I'm using the same sql login username/password combo for each of them. Impersonate is set to false in my web.config file.

Here's my error:

Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

Line 66: cnn = New SqlConnection("data source=BFRENCH2K;initial catalog=PMD;user id=xxxxxx;password=xxxxxx;")
Line 67: cmd = New SqlCommand("Select * from Admin_Users where Username = '" & Username & "'", cnn)
Line 68: cnn.Open()
Line 69: dr = cmd.ExecuteReader()
Line 70: While (dr.Read())

Source File: C:\Inetpub\wwwroot\SiteDoc\Login.aspx.vb Line: 68

Stack Trace:

[UnauthorizedAccessException: Access is denied.]
System.EnterpriseServices.Platform.Initialize() +497
System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb) +11
System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl) +797
System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl) +170
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +358
System.Data.SqlClient.SqlConnection.Open() +384
SiteDoc.Login.ValidateUser(String Username, String Password) in C:\Inetpub\wwwroot\SiteDoc\Login.aspx.vb:68
SiteDoc.Login.btnLogin_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\SiteDoc\Login.aspx.vb:49
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1266|||I located an article that had a solution for my problem.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20850586.html

Check to make sure that the following file has permissions on the ASPNET account:

C:\winnt\system32\com\comadmin.dll

I gave the aspnet account permission to read that file and everything works fine now.|||Thank you
It has solved my Problem.
I was having the same problem.
It was working fine on my machine but when I deployed the project and database to Live server it was giving the error.|||None of the solutions above worked for me.
Instead, I've changed the security settings for the windows account (machine_name\users) to Full Control and grant access to the folder. Obviously the permissions were changed for that folder only.

My asp.net utility is an upload tool and all files uploaded stores themselves into it. Folder is named /imgs/.

I realized today (just today !) of this problem. Last days my webapp worked fine, but I don't know what happened. Maybe some new software just installed, maybe some strange Windows behavior, maybe...??
I think this solution is not secure, because everybody have access to that folder, am I wrong ?
Hope this work, because none of the solutions here, neither in other websites worked.
Sorry for my strange english.
Bye.

Permission Issue

I am trying to test a new ASP.NET application on my local instance of MSDE.
I created a virtual directory named "db" with a sub-directory of
"processed". My web page opens an XML file in the "db" directory, does some
processing and then I want to move the file to the "processed"
sub-directory. When I execute the Move I get the following error:
'************************************************* ***
Exception Details: System.UnauthorizedAccessException: Access to the path
"C:\Inetpub\wwwroot\db\processed\SC313WorldPrelims .xml" is denied.
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer,
choose "Properties" and select the Security tab. Click "Add" to add the
appropriate user or group. Highlight the ASP.NET account, and check the
boxes for the desired access.
Source Error:
Line 50: End If
Line 51: Response.Write("Executing File.Move command!<br>")
Line 52: File.Move(strFilename, fntarget)
Line 53: '*****
Line 54: Else
'************************************************* ****
The instructions don't seem to apply to my system (Win XP Pro SP1)? The
options are different and I don't see any "ASP.NET" account? I suspect I am
min-interpreting something here?
Thanks for any help.
Wayne
Hi
Post this question in microsoft.public.inetserver.iis.security as it is not
a database problem.
Regards
Mike
"Wayne Wengert" wrote:

> I am trying to test a new ASP.NET application on my local instance of MSDE.
> I created a virtual directory named "db" with a sub-directory of
> "processed". My web page opens an XML file in the "db" directory, does some
> processing and then I want to move the file to the "processed"
> sub-directory. When I execute the Move I get the following error:
> '************************************************* ***
> Exception Details: System.UnauthorizedAccessException: Access to the path
> "C:\Inetpub\wwwroot\db\processed\SC313WorldPrelims .xml" is denied.
> ASP.NET is not authorized to access the requested resource. Consider
> granting access rights to the resource to the ASP.NET request identity.
> ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
> Network Service on IIS 6) that is used if the application is not
> impersonating. If the application is impersonating via <identity
> impersonate="true"/>, the identity will be the anonymous user (typically
> IUSR_MACHINENAME) or the authenticated request user.
> To grant ASP.NET write access to a file, right-click the file in Explorer,
> choose "Properties" and select the Security tab. Click "Add" to add the
> appropriate user or group. Highlight the ASP.NET account, and check the
> boxes for the desired access.
> Source Error:
>
> Line 50: End If
> Line 51: Response.Write("Executing File.Move command!<br>")
> Line 52: File.Move(strFilename, fntarget)
> Line 53: '*****
> Line 54: Else
> '************************************************* ****
> The instructions don't seem to apply to my system (Win XP Pro SP1)? The
> options are different and I don't see any "ASP.NET" account? I suspect I am
> min-interpreting something here?
> Thanks for any help.
> Wayne
>
>
>
|||OK - will do
Wayne
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:95192DB5-306F-4001-B69D-9471BEE2088D@.microsoft.com...
> Hi
> Post this question in microsoft.public.inetserver.iis.security as it is
not[vbcol=seagreen]
> a database problem.
> Regards
> Mike
> "Wayne Wengert" wrote:
MSDE.[vbcol=seagreen]
some[vbcol=seagreen]
path[vbcol=seagreen]
or[vbcol=seagreen]
Explorer,[vbcol=seagreen]
am[vbcol=seagreen]

Monday, February 20, 2012

Permission error when trying to set parameters of a server report

Hi There,

I am using SQL Server Reporting Services and generating reports and have them deployed on a report server on Machine A. I have an asp.net web application hosted on MAchine B which has a report viewer control which is used to display a predefined report that is already published on a Reporting Services report server except that it passes a set of parameters for the report. I get this error...The permissions granted to user 'Bla.." are insufficient for performing this operation. (rsAccessDenied) when I try to set the parameters..like this..

param[1] = new Microsoft.Reporting.WebForms.ReportParameter("EndDate", DateTime.Now.ToShortDateString());
param[2] = new Microsoft.Reporting.WebForms.ReportParameter("Site", "1");
reportViewer.ServerReport.SetParameters(param);
reportViewer.ServerReport.Refresh();

I have integrated windows authentication set on the web application (report and report server)

Can anybody suggest me why I am getting this error(breaks at code in red). Any suggestions are greatly aprreciated!!

Thanks.

Sam.

Does the report render fine if you do not set parameters via code?

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
>

Permission Denied error

Windows Pro
VS.Net
.Net Framework
ASP.NET
My 1st time using Web Forms in .Net
1st time using SQL
I am receiving the following error:
System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in
database 'master'. Could not attach database 'pubs' to file 'D:\Program
Files\Microsoft SQL Server\MSSQL$NETSDK\Data\pubs.mdf'.
I tried the following:
Reboot 4-5 times
Share the folder
Web share the folder
Here is some advanced help from another SQL forum.
sp_helpsrvrolemember 'sysadmin' --> command is not on my box.
isql /usa/p/server\sdk -i\instpubs.sql --> did not work. isql is not a
command found on my box.
Any ideas?
Thanks for your help,
THello,
What are you trying to do here? Can you post the commands
To create databases you need system administrator rights and dbcreator
Permissions (from BOL)
CREATE DATABASE permission defaults to members of the sysadmin and dbcreator
fixed server roles. Members of the sysadmin and securityadmin fixed server
roles can grant CREATE DATABASE permissions to other logins. Members of the
sysadmin and dbcreator fixed server role can add other logins to the
dbcreator role. The CREATE DATABASE permission must be explicitly granted;
it is not granted by the GRANT ALL statement.
CREATE DATABASE permission is usually limited to a few logins to maintain
control over disk usage on an instance of SQL Server.
I wouldn't suggest granting the owner of a .NET IIS app either of these
rights
I hope this helps
regards
Greg O MCSD
http://www.ag-software.com/ags_scribe_index.aspx. SQL Scribe Documentation
Builder, the quickest way to document your database
http://www.ag-software.com/ags_SSEPE_index.aspx. AGS SQL Server Extended
Property Extended properties manager for SQL 2000
http://www.ag-software.com/IconExtractionProgram.aspx. Free icon extraction
program
http://www.ag-software.com. Free programming tools
"Taishi" <taishi_bak@.hotmail.com> wrote in message
news:eJuJfV16DHA.360@.TK2MSFTNGP12.phx.gbl...
> Windows Pro
> VS.Net
> .Net Framework
> ASP.NET
> My 1st time using Web Forms in .Net
> 1st time using SQL
> I am receiving the following error:
> System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in
> database 'master'. Could not attach database 'pubs' to file 'D:\Program
> Files\Microsoft SQL Server\MSSQL$NETSDK\Data\pubs.mdf'.
> I tried the following:
> Reboot 4-5 times
> Share the folder
> Web share the folder
> Here is some advanced help from another SQL forum.
> sp_helpsrvrolemember 'sysadmin' --> command is not on my box.
> isql /usa/p/server\sdk -i\instpubs.sql --> did not work. isql is not a
> command found on my box.
>
> Any ideas?
> Thanks for your help,
> T
>|||How can I check the permissions/rights?
How can I grant the correct permissions/rights?
Thanks,
T
"Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
message news:udfB$CE7DHA.2568@.TK2MSFTNGP10.phx.gbl...
> Hello,
> What are you trying to do here? Can you post the commands
> To create databases you need system administrator rights and dbcreator
> Permissions (from BOL)
> CREATE DATABASE permission defaults to members of the sysadmin and
dbcreator
> fixed server roles. Members of the sysadmin and securityadmin fixed server
> roles can grant CREATE DATABASE permissions to other logins. Members of
the
> sysadmin and dbcreator fixed server role can add other logins to the
> dbcreator role. The CREATE DATABASE permission must be explicitly granted;
> it is not granted by the GRANT ALL statement.
> CREATE DATABASE permission is usually limited to a few logins to maintain
> control over disk usage on an instance of SQL Server.
> I wouldn't suggest granting the owner of a .NET IIS app either of these
> rights
>
> --
> I hope this helps
> regards
> Greg O MCSD
> http://www.ag-software.com/ags_scribe_index.aspx. SQL Scribe
Documentation
> Builder, the quickest way to document your database
> http://www.ag-software.com/ags_SSEPE_index.aspx. AGS SQL Server Extended
> Property Extended properties manager for SQL 2000
> http://www.ag-software.com/IconExtractionProgram.aspx. Free icon
extraction
> program
> http://www.ag-software.com. Free programming tools
>
>
> "Taishi" <taishi_bak@.hotmail.com> wrote in message
> news:eJuJfV16DHA.360@.TK2MSFTNGP12.phx.gbl...
> > Windows Pro
> > VS.Net
> > .Net Framework
> > ASP.NET
> > My 1st time using Web Forms in .Net
> > 1st time using SQL
> > I am receiving the following error:
> >
> > System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in
> > database 'master'. Could not attach database 'pubs' to file 'D:\Program
> > Files\Microsoft SQL Server\MSSQL$NETSDK\Data\pubs.mdf'.
> >
> > I tried the following:
> >
> > Reboot 4-5 times
> > Share the folder
> > Web share the folder
> >
> > Here is some advanced help from another SQL forum.
> > sp_helpsrvrolemember 'sysadmin' --> command is not on my box.
> > isql /usa/p/server\sdk -i\instpubs.sql --> did not work. isql is not
a
> > command found on my box.
> >
> >
> > Any ideas?
> >
> > Thanks for your help,
> > T
> >
> >
>|||Hi Tashi!
You can ue Enterprise manager to set the rights. Locate the table, and right
click. Select All Tasks, then Manage Permissions. Locate the user that you
are using in your connection object, and then grant the rights. I agree with
Greg that the web user should not normally have that level of permission.
One false move and your server and data could be toast. If you are really
trying to create a table, or attach a database, you should be doing that
through Enterprise Manager, and not the web interface.
Sloan
"Taishi" <taishi_bak@.hotmail.com> wrote in message
news:u54GDcN7DHA.1428@.TK2MSFTNGP12.phx.gbl...
> How can I check the permissions/rights?
> How can I grant the correct permissions/rights?
> Thanks,
> T
> "Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
> message news:udfB$CE7DHA.2568@.TK2MSFTNGP10.phx.gbl...
> > Hello,
> > What are you trying to do here? Can you post the commands
> >
> > To create databases you need system administrator rights and dbcreator
> >
> > Permissions (from BOL)
> > CREATE DATABASE permission defaults to members of the sysadmin and
> dbcreator
> > fixed server roles. Members of the sysadmin and securityadmin fixed
server
> > roles can grant CREATE DATABASE permissions to other logins. Members of
> the
> > sysadmin and dbcreator fixed server role can add other logins to the
> > dbcreator role. The CREATE DATABASE permission must be explicitly
granted;
> > it is not granted by the GRANT ALL statement.
> >
> > CREATE DATABASE permission is usually limited to a few logins to
maintain
> > control over disk usage on an instance of SQL Server.
> >
> > I wouldn't suggest granting the owner of a .NET IIS app either of these
> > rights
> >
> >
> > --
> > I hope this helps
> > regards
> > Greg O MCSD
> > http://www.ag-software.com/ags_scribe_index.aspx. SQL Scribe
> Documentation
> > Builder, the quickest way to document your database
> > http://www.ag-software.com/ags_SSEPE_index.aspx. AGS SQL Server
Extended
> > Property Extended properties manager for SQL 2000
> > http://www.ag-software.com/IconExtractionProgram.aspx. Free icon
> extraction
> > program
> > http://www.ag-software.com. Free programming tools
> >
> >
> >
> >
> > "Taishi" <taishi_bak@.hotmail.com> wrote in message
> > news:eJuJfV16DHA.360@.TK2MSFTNGP12.phx.gbl...
> > > Windows Pro
> > > VS.Net
> > > .Net Framework
> > > ASP.NET
> > > My 1st time using Web Forms in .Net
> > > 1st time using SQL
> > > I am receiving the following error:
> > >
> > > System.Data.SqlClient.SqlException: CREATE DATABASE permission denied
in
> > > database 'master'. Could not attach database 'pubs' to file
'D:\Program
> > > Files\Microsoft SQL Server\MSSQL$NETSDK\Data\pubs.mdf'.
> > >
> > > I tried the following:
> > >
> > > Reboot 4-5 times
> > > Share the folder
> > > Web share the folder
> > >
> > > Here is some advanced help from another SQL forum.
> > > sp_helpsrvrolemember 'sysadmin' --> command is not on my box.
> > > isql /usa/p/server\sdk -i\instpubs.sql --> did not work. isql is
not
> a
> > > command found on my box.
> > >
> > >
> > > Any ideas?
> > >
> > > Thanks for your help,
> > > T
> > >
> > >
> >
> >
>|||Sloan,
I found the following url.
http://www.aspenterprisemanager.com/
Is Enterprise Manager free?
If so, where can I download it?
Thanks so much for the help,
T.
"Sloan Thrasher" <cst2000@.comcast.net> wrote in message
news:cuQUb.232283$I06.2592550@.attbi_s01...
> Hi Tashi!
> You can ue Enterprise manager to set the rights. Locate the table, and
right
> click. Select All Tasks, then Manage Permissions. Locate the user that you
> are using in your connection object, and then grant the rights. I agree
with
> Greg that the web user should not normally have that level of permission.
> One false move and your server and data could be toast. If you are really
> trying to create a table, or attach a database, you should be doing that
> through Enterprise Manager, and not the web interface.
> Sloan
> "Taishi" <taishi_bak@.hotmail.com> wrote in message
> news:u54GDcN7DHA.1428@.TK2MSFTNGP12.phx.gbl...
> > How can I check the permissions/rights?
> >
> > How can I grant the correct permissions/rights?
> >
> > Thanks,
> > T
> >
> > "Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
> > message news:udfB$CE7DHA.2568@.TK2MSFTNGP10.phx.gbl...
> > > Hello,
> > > What are you trying to do here? Can you post the commands
> > >
> > > To create databases you need system administrator rights and dbcreator
> > >
> > > Permissions (from BOL)
> > > CREATE DATABASE permission defaults to members of the sysadmin and
> > dbcreator
> > > fixed server roles. Members of the sysadmin and securityadmin fixed
> server
> > > roles can grant CREATE DATABASE permissions to other logins. Members
of
> > the
> > > sysadmin and dbcreator fixed server role can add other logins to the
> > > dbcreator role. The CREATE DATABASE permission must be explicitly
> granted;
> > > it is not granted by the GRANT ALL statement.
> > >
> > > CREATE DATABASE permission is usually limited to a few logins to
> maintain
> > > control over disk usage on an instance of SQL Server.
> > >
> > > I wouldn't suggest granting the owner of a .NET IIS app either of
these
> > > rights
> > >
> > >
> > > --
> > > I hope this helps
> > > regards
> > > Greg O MCSD
> > > http://www.ag-software.com/ags_scribe_index.aspx. SQL Scribe
> > Documentation
> > > Builder, the quickest way to document your database
> > > http://www.ag-software.com/ags_SSEPE_index.aspx. AGS SQL Server
> Extended
> > > Property Extended properties manager for SQL 2000
> > > http://www.ag-software.com/IconExtractionProgram.aspx. Free icon
> > extraction
> > > program
> > > http://www.ag-software.com. Free programming tools
> > >
> > >
> > >
> > >
> > > "Taishi" <taishi_bak@.hotmail.com> wrote in message
> > > news:eJuJfV16DHA.360@.TK2MSFTNGP12.phx.gbl...
> > > > Windows Pro
> > > > VS.Net
> > > > .Net Framework
> > > > ASP.NET
> > > > My 1st time using Web Forms in .Net
> > > > 1st time using SQL
> > > > I am receiving the following error:
> > > >
> > > > System.Data.SqlClient.SqlException: CREATE DATABASE permission
denied
> in
> > > > database 'master'. Could not attach database 'pubs' to file
> 'D:\Program
> > > > Files\Microsoft SQL Server\MSSQL$NETSDK\Data\pubs.mdf'.
> > > >
> > > > I tried the following:
> > > >
> > > > Reboot 4-5 times
> > > > Share the folder
> > > > Web share the folder
> > > >
> > > > Here is some advanced help from another SQL forum.
> > > > sp_helpsrvrolemember 'sysadmin' --> command is not on my box.
> > > > isql /usa/p/server\sdk -i\instpubs.sql --> did not work. isql is
> not
> > a
> > > > command found on my box.
> > > >
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks for your help,
> > > > T
> > > >
> > > >
> > >
> > >
> >
> >
>|||You can use MSDE and Access as a backend for a website.
I am uninitiated but I know this for a fact.
"Sloan Thrasher" <cst2000@.comcast.net> wrote in message
news:b3FVb.259176$na.418905@.attbi_s04...
> Hi Tashi!
> I haven't installed MSDE, but it should have asked for a sa password
during
> installation. If so, and you remember it, you could use asp to connect and
> add the DBs you need, but definately not something for the uninitiated.
> Also, I'm not sure, but I don't think you're allowed to use MSDE as a
> backend for a web site.
> Since you're new to ASP.net, SQL, etc. you might want to start out with
> something a bit simplier, like an Access DB (if you have MS Office, you
have
> Access) That way you have a GUI to create your database and tables in and
> you can focus on one thing at a time.
> If you really want to move forward with MSDE, then look at this link:
>
http://msdn.microsoft.com/library/?url=/library/en-us/distsql/distsql_84xl.a
> sp?frame=true
> The topic is Customizing MDSE Setup.exe. In there you will see how to
setup
> the SA password, the default directory for your data files, and a lot
more.
> I found it by D/L the app and the HTML readme file.
> Sloan
>
> "Taishi" <taishi_bak@.hotmail.com> wrote in message
> news:#zV2Aes7DHA.3804@.tk2msftngp13.phx.gbl...
> > Sloan,
> >
> > I installed the MSDE 2000 from the following web site:
> >
> > ww.microsoft.com/downloads
> >
> > Featured download
> > Microsoft SQL Server 2000
> > Desktop Engine(MSDE 2000) Release A
> >
> > I don't have the SQL server disks.
> >
> > Any ideas?
> >
> > Thanks,
> > T.
> >
> > "Sloan Thrasher" <cst2000@.comcast.net> wrote in message
> > news:J1EVb.125043$U%5.607067@.attbi_s03...
> > > Hi Tashi!
> > >
> > > Enterprise Manager comes with SQL Server. You should be able to
install
> it
> > > from the MS SQL Server CDs
> > >
> > > Sloan
> > >
>