473,396 Members | 1,853 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,396 software developers and data experts.

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(HttpContext.Current.Server.MapPath(Me .SiteMapUrl))

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' 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_SHAPPER)

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' is denied."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String
role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Objec t
xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedSta ck
compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at By27.Web.UI.Footer.by27f_pSiteMap_Init(Object sender,
EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32
index)
at System.Web.UI.ControlCollection.Add(Control child)
at By27.Web.UI.Footer.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

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

intersense

"shapper" <md*****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.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(HttpContext.Current.Server.MapPath(Me .SiteMapUrl))

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' 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_SHAPPER)

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' is denied."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String
role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Objec t
xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedSta ck
compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at By27.Web.UI.Footer.by27f_pSiteMap_Init(Object sender,
EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32
index)
at System.Web.UI.ControlCollection.Add(Control child)
at By27.Web.UI.Footer.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
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\NETWORK 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.Name()
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.comwrote in message news:eF**************@TK2MSFTNGP03.phx.gbl...
You should add the account networservice.
Good luck.

intersense

"shapper" <md*****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.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(HttpContext.Current.Server.MapPath(Me .SiteMapUrl))

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' 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_SHAPPER)

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' is denied."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String
role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Objec t
xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.Ex ecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedSta ck
compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at By27.Web.UI.Footer.by27f_pSiteMap_Init(Object sender,
EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32
index)
at System.Web.UI.ControlCollection.Add(Control child)
at By27.Web.UI.Footer.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

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\NETWORK 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\NETWORK 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.Name()
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.comwrote in message news:eF**************@TK2MSFTNGP03.phx.gbl...
You should add the account networservice.
Good luck.

intersense

"shapper" <md*****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.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(HttpContext.Current.Server.MapPath(Me .SiteMapUrl))

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' 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_SHAPPER)

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.UnauthorizedAccessException was unhandled by user code
Message="Access to the path 'C:\Documents and Settings\User\My
Documents\Visual Studio 2005\WebSites\MyWebSite' is denied."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode,
FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs,
String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String
role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Objec t
xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedSta ck
compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at By27.Web.UI.Footer.by27f_pSiteMap_Init(Object sender,
EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32
index)
at System.Web.UI.ControlCollection.Add(Control child)
at By27.Web.UI.Footer.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nov 7 '06 #4

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

Similar topics

2
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....
16
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"....
1
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...
1
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...
6
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...
1
by: nasirmajor | last post by:
dear all, Please any urgent help regarding following code. i have the following code ================================================================= public void Delete(Object sender,...
18
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...
4
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....
1
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.