473,583 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't access file. Please, help.

Hello,

In have a class inside a compiled DLL where I have the following code:

' Create site map XML document
Dim siteMap As XmlDocument = New XmlDocument
' Load site map XML document from ASP.NET web site map
siteMap.Load(Ht tpContext.Curre nt.Server.MapPa th(Me.SiteMapUr l))

Me.SiteMapUrl is a property.

In my web site I use this class and I set Me.SiteMapUrl =
"~/Web.sitemap".

When I run the page I get an error saying:
"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."

I went to MyWebSite folder Security and gave Full Control to:
ASP.NET Machine Account (SHAPPER\ASPNET )
and
Internet Guest Account (SHAPPER\IUSR_S HAPPER)

I keep having the same error.
I tried everything I could think off but I was not able to solve this.

Could someone tell me how to solve this?

Thanks,
Miguel

P.S: Here is my full error detail.

"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."
Source="mscorli b"
StackTrace:
at System.IO.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath)
at System.IO.FileS tream.Init(Stri ng path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String
role, Type ofObjectToRetur n)
at System.Xml.XmlT extReaderImpl.O penUrlDelegate( Object
xmlResolver)
at System.Threadin g.CompressedSta ck.runTryCode(O bject userData)
at
System.Runtime. CompilerService s.RuntimeHelper s.ExecuteCodeWi thGuaranteedCle anup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threadin g.CompressedSta ck.Run(Compress edStack
compressedStack , ContextCallback callback, Object state)
at System.Xml.XmlT extReaderImpl.O penUrl()
at System.Xml.XmlT extReaderImpl.R ead()
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at By27.Web.UI.Foo ter.by27f_pSite Map_Init(Object sender,
EventArgs e)
at System.Web.UI.C ontrol.OnInit(E ventArgs e)
at System.Web.UI.C ontrol.InitRecu rsive(Control namingContainer )
at System.Web.UI.C ontrol.AddedCon trol(Control control, Int32
index)
at System.Web.UI.C ontrolCollectio n.Add(Control child)
at By27.Web.UI.Foo ter.CreateChild Controls()
at System.Web.UI.C ontrol.EnsureCh ildControls()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)

Nov 4 '06 #1
3 2221
You should add the account networservice.
Good luck.

intersense

"shapper" <md*****@gmail. comwrote in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
Hello,

In have a class inside a compiled DLL where I have the following code:

' Create site map XML document
Dim siteMap As XmlDocument = New XmlDocument
' Load site map XML document from ASP.NET web site map
siteMap.Load(Ht tpContext.Curre nt.Server.MapPa th(Me.SiteMapUr l))

Me.SiteMapUrl is a property.

In my web site I use this class and I set Me.SiteMapUrl =
"~/Web.sitemap".

When I run the page I get an error saying:
"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."

I went to MyWebSite folder Security and gave Full Control to:
ASP.NET Machine Account (SHAPPER\ASPNET )
and
Internet Guest Account (SHAPPER\IUSR_S HAPPER)

I keep having the same error.
I tried everything I could think off but I was not able to solve this.

Could someone tell me how to solve this?

Thanks,
Miguel

P.S: Here is my full error detail.

"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."
Source="mscorli b"
StackTrace:
at System.IO.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath)
at System.IO.FileS tream.Init(Stri ng path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String
role, Type ofObjectToRetur n)
at System.Xml.XmlT extReaderImpl.O penUrlDelegate( Object
xmlResolver)
at System.Threadin g.CompressedSta ck.runTryCode(O bject userData)
at
System.Runtime. CompilerService s.RuntimeHelper s.ExecuteCodeWi thGuaranteedCle anup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threadin g.CompressedSta ck.Run(Compress edStack
compressedStack , ContextCallback callback, Object state)
at System.Xml.XmlT extReaderImpl.O penUrl()
at System.Xml.XmlT extReaderImpl.R ead()
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at By27.Web.UI.Foo ter.by27f_pSite Map_Init(Object sender,
EventArgs e)
at System.Web.UI.C ontrol.OnInit(E ventArgs e)
at System.Web.UI.C ontrol.InitRecu rsive(Control namingContainer )
at System.Web.UI.C ontrol.AddedCon trol(Control control, Int32
index)
at System.Web.UI.C ontrolCollectio n.Add(Control child)
at By27.Web.UI.Foo ter.CreateChild Controls()
at System.Web.UI.C ontrol.EnsureCh ildControls()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
Nov 5 '06 #2
Not unless he's running Windows Server 2003.
I think shapper is running Windows XP Pro.

In any case, the account would be : NT AUTHORITY\NETWO RK SERVICE.

What shapper really needs to do is identify
the account which ASP.NET is running as.

shapper: save the following page to any web directory and run it.

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

Then, grant the necessary file permissions to the account returned by that page.


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/
=============== =============== =====
"intersense " <gw******@msn.c omwrote in message news:eF******** ******@TK2MSFTN GP03.phx.gbl...
You should add the account networservice.
Good luck.

intersense

"shapper" <md*****@gmail. comwrote in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
>Hello,

In have a class inside a compiled DLL where I have the following code:

' Create site map XML document
Dim siteMap As XmlDocument = New XmlDocument
' Load site map XML document from ASP.NET web site map
siteMap.Load(Ht tpContext.Curre nt.Server.MapPa th(Me.SiteMapUr l))

Me.SiteMapUr l is a property.

In my web site I use this class and I set Me.SiteMapUrl =
"~/Web.sitemap".

When I run the page I get an error saying:
"System.Unauth orizedAccessExc eption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visu al Studio 2005\WebSites\M yWebSite' is denied."

I went to MyWebSite folder Security and gave Full Control to:
ASP.NET Machine Account (SHAPPER\ASPNET )
and
Internet Guest Account (SHAPPER\IUSR_S HAPPER)

I keep having the same error.
I tried everything I could think off but I was not able to solve this.

Could someone tell me how to solve this?

Thanks,
Miguel

P.S: Here is my full error detail.

"System.Unauth orizedAccessExc eption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visu al Studio 2005\WebSites\M yWebSite' is denied."
Source="mscorli b"
StackTrace:
at System.IO.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPat h)
at System.IO.FileS tream.Init(Stri ng path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String
role, Type ofObjectToRetur n)
at System.Xml.XmlT extReaderImpl.O penUrlDelegate( Object
xmlResolver)
at System.Threadin g.CompressedSta ck.runTryCode(O bject userData)
at
System.Runtime .CompilerServic es.RuntimeHelpe rs.ExecuteCodeW ithGuaranteedCl eanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threadin g.CompressedSta ck.Run(Compress edStack
compressedStac k, ContextCallback callback, Object state)
at System.Xml.XmlT extReaderImpl.O penUrl()
at System.Xml.XmlT extReaderImpl.R ead()
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at By27.Web.UI.Foo ter.by27f_pSite Map_Init(Object sender,
EventArgs e)
at System.Web.UI.C ontrol.OnInit(E ventArgs e)
at System.Web.UI.C ontrol.InitRecu rsive(Control namingContainer )
at System.Web.UI.C ontrol.AddedCon trol(Control control, Int32
index)
at System.Web.UI.C ontrolCollectio n.Add(Control child)
at By27.Web.UI.Foo ter.CreateChild Controls()
at System.Web.UI.C ontrol.EnsureCh ildControls()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesB eforeAsyncPoint , Boolean includeStagesAf terAsyncPoint)

Nov 5 '06 #3
Hi,

the account that code returned was "Shapper\Miguel "

I allready granted full permission to that account. It was one of the
first things I did.

I also granted Full permissions to Network Service.
This is what I have. I don't see NT AUTHORITY\NETWO RK SERVICE in the
list.

I keep having the same problem.
I am running Windows XP SP2

This is really strange.
I am on this for days.

Any idea?

Maybe the problem is in my code? I think it is not but I am out of
ideas...

Thanks,
Miguel

Juan T. Llibre wrote:
Not unless he's running Windows Server 2003.
I think shapper is running Windows XP Pro.

In any case, the account would be : NT AUTHORITY\NETWO RK SERVICE.

What shapper really needs to do is identify
the account which ASP.NET is running as.

shapper: save the following page to any web directory and run it.

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

Then, grant the necessary file permissions to the account returned by that page.


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/
=============== =============== =====
"intersense " <gw******@msn.c omwrote in message news:eF******** ******@TK2MSFTN GP03.phx.gbl...
You should add the account networservice.
Good luck.

intersense

"shapper" <md*****@gmail. comwrote in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
Hello,

In have a class inside a compiled DLL where I have the following code:

' Create site map XML document
Dim siteMap As XmlDocument = New XmlDocument
' Load site map XML document from ASP.NET web site map
siteMap.Load(Ht tpContext.Curre nt.Server.MapPa th(Me.SiteMapUr l))

Me.SiteMapUrl is a property.

In my web site I use this class and I set Me.SiteMapUrl =
"~/Web.sitemap".

When I run the page I get an error saying:
"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."

I went to MyWebSite folder Security and gave Full Control to:
ASP.NET Machine Account (SHAPPER\ASPNET )
and
Internet Guest Account (SHAPPER\IUSR_S HAPPER)

I keep having the same error.
I tried everything I could think off but I was not able to solve this.

Could someone tell me how to solve this?

Thanks,
Miguel

P.S: Here is my full error detail.

"System.Unautho rizedAccessExce ption was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\M y
Documents\Visua l Studio 2005\WebSites\M yWebSite' is denied."
Source="mscorli b"
StackTrace:
at System.IO.__Err or.WinIOError(I nt32 errorCode, String
maybeFullPath)
at System.IO.FileS tream.Init(Stri ng path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String
role, Type ofObjectToRetur n)
at System.Xml.XmlT extReaderImpl.O penUrlDelegate( Object
xmlResolver)
at System.Threadin g.CompressedSta ck.runTryCode(O bject userData)
at
System.Runtime. CompilerService s.RuntimeHelper s.ExecuteCodeWi thGuaranteedCle anup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threadin g.CompressedSta ck.Run(Compress edStack
compressedStack , ContextCallback callback, Object state)
at System.Xml.XmlT extReaderImpl.O penUrl()
at System.Xml.XmlT extReaderImpl.R ead()
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at By27.Web.UI.Foo ter.by27f_pSite Map_Init(Object sender,
EventArgs e)
at System.Web.UI.C ontrol.OnInit(E ventArgs e)
at System.Web.UI.C ontrol.InitRecu rsive(Control namingContainer )
at System.Web.UI.C ontrol.AddedCon trol(Control control, Int32
index)
at System.Web.UI.C ontrolCollectio n.Add(Control child)
at By27.Web.UI.Foo ter.CreateChild Controls()
at System.Web.UI.C ontrol.EnsureCh ildControls()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
Nov 7 '06 #4

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

Similar topics

2
4753
by: Roald Oines | last post by:
Hi, I'm working on converting several of my Access 97 databases to Access 2002 format (the company's changing from NT 4 to XP and updating Office at the same time), and this one has me stumped. As a performance enhancer, I use VBA code (transfertext) to export the results of a query (usually 20-30 thousand rows with a few dozen fields of...
16
1302
by: pshyamsunder | last post by:
Hi: I am facing a strange problem. I have opened a file "File1" using fopen() and while processing the records in the file in a loop, I have a call to access() to check existence of "File2". The reason is to stop processing further records when the file "File2" exists. But the access() call fails when the file "File1" is open.
1
2453
by: Joe | last post by:
Hi, I have an asp.net page that opens up a connection to MS access DB and does insert into DB. I am using close() and setting the connection object to Nothing after I am done with inserting a record. After inserting when I look at the server where the MS access DB resides I also see a *.ldb file also. For some reason I cannot get rid of this...
1
1634
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im facing a problem in opening some forms from command button a message appear the openform action was canceled and when i open them from the database...
6
4858
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still...
1
2352
by: nasirmajor | last post by:
dear all, Please any urgent help regarding following code. i have the following code ================================================================= public void Delete(Object sender, DataGridCommandEventArgs e) { 1 int Sid2 = (int)l.DataKeys;
18
9119
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft page "How to: Connect to Data in an Access Database"
4
5478
by: kev | last post by:
Hi folks, I have created a database to store information on equipments. During the first level of registration, there is a form that i need the user to fill up details on the equipment testing. i have done this one.Now what i need is to enable the users to upload files and save it into the corresponding table. Example: 3. A laser...
1
8969
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA which is a webserver running Win2k3 with IIS6, my domain account is a local administrator on this machine. The web app I am running is trying to...
0
1159
by: dhaneshrs | last post by:
Heya guys, i need your urgent help.. Its in ASP .NET with Access DB. I am attaching the file i have done so far from various sources and help from people around me. My friends who have worked with asp .net have used SQL as the backend and never used a ccess. Well i dont blame them, its a smart choice. But because i choose to use access in my...
0
7895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8193
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1433
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.