By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,491 Members | 1,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,491 IT Pros & Developers. It's quick & easy.

Need to read a text file from a network share

P: 1
Ok, I'm brand new to IIS and asp. (My experience is with apache on Solaris but we have gotten rid of that system.) I need to readin a text file with asp that is on the C: drive of another Windows server that is not running IIS. I created a share on folder containing the text file on the second server and made it available to the Everyone Group.

The asp program, which works when the file is local, doesn't work when I modify the Server.MapPath line to use an UNC.

Expand|Select|Wrap|Line Numbers
  1. DispFile= Server.MapPath("\\190.232.176.10\\ArcGISLicenseLog\\ESRILicenseUse.txt")
  2. 'DispFile= Server.MapPath("ESRILicenseUse.txt")
  3. Set FileObject = Server.CreateObject("Scripting.FileSystemObject") 
  4. Set InStream = FileObject.OpenTextFile (DispFile) 
  5.  
From what I've read Server.MapPath doesn't work with those. How do I read a text file from a network share and is there any special permissions needed on the network share beyone the Everyone group?

Thanks
Dec 10 '10 #1
Share this Question
Share on Google+
2 Replies


P: 80
Try mapping the network drive.
Dec 10 '10 #2

danp129
Expert 100+
P: 321
I don't know for sure what problems you are going to run into as I haven't tried it and don't have the right environment to test, but here's my two cents:

1) FSO does have the ability to open UNC paths as stated here. However, you may or may not have issues using the IUSR_MACHINENAME or whatever account your site is running under accessing the other computer, just have to try and see.

2) Server.MapPath shouldn't need to be used, you are already specifying the full path which is all that function returns.

3) You should only have "\\" at the beginning of the UNC path, not after the folders.
Dec 11 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.