"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"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:uaqU3wViFHA.3568@.TK2MSFTNGP10.phx.gbl...
> 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
Thanks for the suggestion but after doing that I still get the same error?
Wayne
"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:eTlcryWiFHA.1460@.tk2msftngp13.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:uaqU3wViFHA.3568@.TK2MSFTNGP10.phx.gbl...
>> 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
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:OV5Ov3WiFHA.1148@.TK2MSFTNGP12.phx.gbl...
> 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
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
"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:Og0ICGXiFHA.3544@.TK2MSFTNGP15.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:OV5Ov3WiFHA.1148@.TK2MSFTNGP12.phx.gbl...
>> 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
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
> 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
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
> 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
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
"WJ" <JohnWebbs@.HotMail.Com> wrote in message
news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>> 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
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>
---
Hope this helps...
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:uAtm5ffiFHA.3448@.TK2MSFTNGP12.phx.gbl...
> 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
> "WJ" <JohnWebbs@.HotMail.Com> wrote in message
> news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
>>
>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>>> 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
>>
>>
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
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:eVXEvCgiFHA.1444@.TK2MSFTNGP10.phx.gbl...
> 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>
> ---
> Hope this helps...
>
> Juan T. Llibre
> ASP.NET MVP
> http://asp.net.do/foros/
> Foros de ASP.NET en Espaol
> Ven, y hablemos de ASP.NET...
> ======================
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:uAtm5ffiFHA.3448@.TK2MSFTNGP12.phx.gbl...
>> 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
>>
>> "WJ" <JohnWebbs@.HotMail.Com> wrote in message
>> news:eJobGXXiFHA.3936@.TK2MSFTNGP10.phx.gbl...
>>>
>>> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
>>> news:%233bhDRXiFHA.3280@.TK2MSFTNGP10.phx.gbl...
>>>> 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
>>>
>>>
>>
>>
0 comments:
Post a Comment