Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > problem writing a file

Thread Tools

problem writing a file

Iain A. Mcleod
Posts: n/a
I'm really stuck with this one - wondering if you can spot the problem?
I think that it's a webserver problem that goes deeper than web.config.
I've not been able to write to a file on a network share via ASP.NET. The
network share is not the same as the webserver.

relevant section of web.config:
<!-- the location we cannot write to. My staging server
doesn't have write permissions here, but I do if authenticating as
myself -->
<add key="ProjectCollection"
value=\\my_server\userhome\MyAccount\websiteTests\ test.txt />
<!-- Neither of these work!
I have write perms here for my user accunt and believe that
my staging server has write perms here too
add key="ProjectCollection"
value=\\my_server\commondocuments\websiteTests\tes t.txt />
<!-- I have also tried "None" here -->
<authentication mode="Windows" />

<!-- I have tried leaving this out -->
<identity impersonate="true" />

<allow users="mydomain\myusername" />
<deny users="*" />
<!-- I have tried allow users="*" but I think that then my server
tries to authenticate as ASPNET. This certainly should not access my home
folder, but should??? access the common share. I believe that my
administrator has set up access privs for my server on the common share. It
doesn't access it however! -->
Relevant code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
'identity we are running as - 2 ways of getting the same
' returns my username if I am impersonating and
authenticating in web.config
'however, still cannot write to either folder no
matter what I am impersonating or not

Trace.Write(System.Security.Principal.WindowsIdent ity.GetCurrent().Name)
'filename we are trying to write to
Dim strFileName As String =
ConfigurationSettings.AppSettings("ProjectCollecti on")
'fails here. This creates a file in location specified by
Config setting above
Dim fs As FileStream = New FileStream(strFileName,
Dim w As New StreamWriter(fs)
End Sub
Any Ideas?
Many thanks
Sorry for long post

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
encoding problem with BeautifulSoup - problem when writing parsedtext to file Greg Python 9 10-08-2011 03:30 PM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM
Question: Writing text file based TestBenches vs. Waveform file based simulation. BLF VHDL 4 08-07-2004 12:44 AM
A failure occurred writing to the resources file. Access is denied. -- RESX file is locked? -- WHY? Mark Kamoski ASP .Net 1 07-04-2003 12:02 PM