Re: Can't access file. Please, help.



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" <gwdotnet@xxxxxxx> wrote in message news:eF3QYpMAHHA.4740@xxxxxxxxxxxxxxxxxxxxxxx
You should add the account networservice.
Good luck.

intersense

"shapper" <mdmoura@xxxxxxxxx> wrote in message
news:1162654893.165581.292420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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(Object
xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack
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)



.



Relevant Pages

  • RE: Cant write to a file
    ... If you are running Windows 2003, you need to give IIS_WPG Group rights on ... That is the account under which the application runs in Windows ... > The ASPNET account has read/write permissions on the folder ... > access, FileShare share, Int32 bufferSize, Boolean useAsync, String ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Installing WSS 3.0 on SBS 2003 after Uninstalling WSS 2.0
    ... 2003 SP1 with SQL Server 2005 Standard Edition after removing ... SPSearch ([service account]) ... IdentityType identityType, Boolean bDontRestartService) at ... Boolean isAdminProcess, Boolean isWindowsService, String ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Cant access file. Please, help.
    ... You should add the account networservice. ... ' Load site map XML document from ASP.NET web site map ... FileAccess access, Int32 rights, Boolean useRights, FileShare share, ... Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Installing WSS 3.0 on SBS 2003 after Uninstalling WSS 2.0
    ... 2003 SP1 with SQL Server 2005 Standard Edition after removing ... Where [service account] is a domain user account specifically created ... IdentityType identityType, Boolean bDontRestartService) at ... Boolean isAdminProcess, Boolean isWindowsService, String ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Help needed on Windows 2000 Admin password
    ... Steve ... >> which is running Windows 2000.... ... Create an account for your wife on your own PC. ... Create the same account on your wife's PC, ...
    (microsoft.public.win2000.setup)