473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

impersonation

In an aspx page I have a datagrid populated by an oledbDataAdaptor and
dataset from a Microsoft Access database.
When the line <identity impersonate="true" /> is placed in the web.config ,
I am able to populate and view the datagrid. I am also able to add a new
record to the datagrid by using:
this.dateSett11.Table1.Rows.InsertAt(dr, 9999999);
DataAdaptDA.Update(dateSett11);

When I remove the line <identity impersonate="true" /> from web.config , I
can populate and view the datagrid but when I try to add a record, I get the
error:
The Microsoft Jet database engine cannot open the file
'C:\Inetpub\wwwroot\testo\DatsDB.mdb'. It is already opened exclusively by
another user, or you need permission to view its data.
This posting may show my limited understanding of permissions,
never-the-less I would like to find out what I must do to be able to write
to the dataset without using impersonation. Where do I set or change the
premissions ?
Thanks in advance for your help,
Jim
Nov 19 '05 #1
3 2034
You need to give the user account your website is running as a minimum of
modify permissions on the .mdb database file. When identity impersonate =
true is used then the web site is running as the ASPNET account on a windows
xp box normally the website runs as IUSR_[MachineName] when identity
impersonate is set to false (or not included). You can take care of this in
a couple of different ways. You could create a new account for the website
to run as and then give that account modify permissions to the .mdb file, or
you could just give the IUSR_[MachineName] account modify permissions to the
..mdb file.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Jim McGivney" <mc****@no-spam.sbcglobal.net> wrote in message
news:OW****************@tk2msftngp13.phx.gbl...
In an aspx page I have a datagrid populated by an oledbDataAdaptor and
dataset from a Microsoft Access database.
When the line <identity impersonate="true" /> is placed in the web.config
, I am able to populate and view the datagrid. I am also able to add a
new record to the datagrid by using:
this.dateSett11.Table1.Rows.InsertAt(dr, 9999999);
DataAdaptDA.Update(dateSett11);

When I remove the line <identity impersonate="true" /> from web.config , I
can populate and view the datagrid but when I try to add a record, I get
the error:
The Microsoft Jet database engine cannot open the file
'C:\Inetpub\wwwroot\testo\DatsDB.mdb'. It is already opened exclusively by
another user, or you need permission to view its data.
This posting may show my limited understanding of permissions,
never-the-less I would like to find out what I must do to be able to write
to the dataset without using impersonation. Where do I set or change the
premissions ?
Thanks in advance for your help,
Jim

Nov 19 '05 #2
re:
When I remove the line <identity impersonate="true" /> from web.config ,
I can populate and view the datagrid but when I try to add a record,
I get the error: I would like to find out what I must do to be able to write to the dataset
without using impersonation. Where do I set or change the permissions ?
Hi, Jim.

You're going to have to detect the account under
which ASP.NET is running when it is not being impersonated.

Save the following as identity.aspx and run it *without* enabling impersonation.

identity.aspx
-------------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
------------------

When you run that file, it will return the current ASP.NET identity,
i.e., the account ASP.NET is running as, when not impersonating.

Give *that* account the access permissions to the directory and file.

To assign the necessary ASP.NET permissions to that account, so that
the default directories ASP.NET needs are allowed access when you're
running "ordinary" ASP.NET files, run the following command from a
command window in the .Net Framework directory :

aspnet_regiis -ga MachineName\AccountName

(Write whatever machine and account name the identity.aspx file returned.)

Doing that should set you up as ready to go...


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================

"Jim McGivney" <mc****@no-spam.sbcglobal.net> wrote in message
news:OW****************@tk2msftngp13.phx.gbl... In an aspx page I have a datagrid populated by an oledbDataAdaptor and dataset from a
Microsoft Access database.
When the line <identity impersonate="true" /> is placed in the web.config , I am able to
populate and view the datagrid. I am also able to add a new record to the datagrid by
using:
this.dateSett11.Table1.Rows.InsertAt(dr, 9999999);
DataAdaptDA.Update(dateSett11);

When I remove the line <identity impersonate="true" /> from web.config , I can populate
and view the datagrid but when I try to add a record, I get the error:
The Microsoft Jet database engine cannot open the file
'C:\Inetpub\wwwroot\testo\DatsDB.mdb'. It is already opened exclusively by another user,
or you need permission to view its data.
This posting may show my limited understanding of permissions, never-the-less I would
like to find out what I must do to be able to write to the dataset without using
impersonation. Where do I set or change the premissions ?
Thanks in advance for your help,
Jim


Nov 19 '05 #3
On Wed, 19 Oct 2005 11:20:11 -0500, "Jim McGivney" <mc****@no-spam.sbcglobal.net> wrote:

¤ In an aspx page I have a datagrid populated by an oledbDataAdaptor and
¤ dataset from a Microsoft Access database.
¤ When the line <identity impersonate="true" /> is placed in the web.config ,
¤ I am able to populate and view the datagrid. I am also able to add a new
¤ record to the datagrid by using:
¤ this.dateSett11.Table1.Rows.InsertAt(dr, 9999999);
¤ DataAdaptDA.Update(dateSett11);
¤
¤ When I remove the line <identity impersonate="true" /> from web.config , I
¤ can populate and view the datagrid but when I try to add a record, I get the
¤ error:
¤ The Microsoft Jet database engine cannot open the file
¤ 'C:\Inetpub\wwwroot\testo\DatsDB.mdb'. It is already opened exclusively by
¤ another user, or you need permission to view its data.
¤ This posting may show my limited understanding of permissions,
¤ never-the-less I would like to find out what I must do to be able to write
¤ to the dataset without using impersonation. Where do I set or change the
¤ premissions ?
¤ Thanks in advance for your help,
¤ Jim
¤

See the following:

PRB: Cannot connect to Access database from ASP.NET
http://support.microsoft.com/?scid=k...d=2514&sid=300
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ripa Horatiu | last post by:
Does anyone knows how can I impersonate to another user (basically Administrator) for a piece of my code? I've tried the samples provided by MS but they didn't worked. -- Horatiu Ripa
12
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The...
1
by: techfuzz | last post by:
I'm posting my problem experience and solution I found here for other ASP.NET developers. I have a web application that uses Forms Authentication with Active Directory to control access. In...
12
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The...
5
by: =?Utf-8?B?S2l0dHlIYXdr?= | last post by:
I am in the process of migrating an II6 environment from a single server to a network load balanced system. Thus, I am using a virtual directory on a UNC share to house the dynamic data that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.