Permission Issue

W

Wayne Wengert

I am trying to test some aspx pages on my local system. The code requires a
"db" directory off the root of the web site. In my Inetpub/myproj I added
the directory but cannot figure out how to give the application authority to
write into that directory. I get the error:

System.UnauthorizedAccessException: Access to the path
"c:\inetpub\wwwroot\OfficeApp\db\judgedata.csv" is denied.

In the error information it says to grant ASP.NET write access to a file,
right-click the file in Explorer, choose "Properties" and select the
Security tab. There is no "Security" tab. I must be missing something here?
How do I set that directory to allow asp.net to write to it?

Wayne
 
W

WJ

Security tab. There is no "Security" tab. I must be missing something
here?

Uncheck the "Use simple file sharing" (bottom option) in the "View" tab of
the "Folder Options" dialog.

John
 
W

Wayne Wengert

Thanks for the suggestion but after doing that I still get the same error?

Wayne
 
W

WJ

Thanks for the suggestion but after doing that I still get the same error?

This only lets you use the "Security" tab on the Windows Explorer. To fix
the error (access denied), you must grant r/w access to the account that
runs your website to the database file where your data resides.

John
 
W

Wayne Wengert

John;

Thanks for the clarification. I did that and gave ASP.NET full control of
that directory but it still gives the same error when the code attempts to
create a file in that directory?

Wayne
 
W

WJ

Wayne Wengert said:
John;

Thanks for the clarification. I did that and gave ASP.NET full control of
that directory but it still gives the same error when the code attempts to
create a file in that directory?

Check your local website (IIS/MMC) to find out what account is configured
for the web site, then grant FC to that account. Example: If you allow
"Anonymous" access to the web site, then the User Account box likely shows
"IUSR_YourPCName". Try that see what happens.

John
 
W

Wayne Wengert

John;

Thanks for the continued help. I am not sure how to determine which account
is configured for the web site (I thought ASP.NET was always used by VSNET
projects?) I went to Control Panel/Administrative Tools/IIS and Properties
but I don't see how to determine the default user for a web site?

Wayne
 
J

Juan T. Llibre

Hi, Wayne.

This all boils down to giving the account ASP.NET is running
under, *whichever account that is* the necessary permissions.

If you have doubts about which account ASP.NET is running under,
just run this short script. It will identify ASP.NET's current identity.

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>
 
W

Wayne Wengert

Juan;

Thanks for that page. That is a handy little tool to have. It revealed that
the account used is "myMachine/ASPNET" (no ".") I gave that FC but it still
gives me the erron on my local machine - it works fine on my real web site.

Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top