Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My MapPath Command isn't doing anything! Lazy blighter!

Status
Not open for further replies.

marshalsea

Programmer
May 26, 2000
51
GB
Ok i've worked out where the problem lies with my last question.<br><br>Here's a couple of lines of code from the Global.asa:<br><br>&nbsp;&nbsp;Set fso = server.CreateObjec(&quot;Scripting.FileSystemObject&quot;)<br>&nbsp;&nbsp;filename = Server.MapPath(&quot;Settings.txt&quot;)<br>&nbsp;&nbsp;Set filehdl = fso.CreateTextFile(filename,True)<br><br>I've tried the following combinations of the MapPath lines:<br>&nbsp;&nbsp;Filename = Server.MapPath(&quot;/Settings.txt&quot;)<br>&nbsp;&nbsp;Filename = Server.MapPath(&quot;\Settings.txt&quot;)<br>&nbsp;&nbsp;Filename = Server.MapPath(&quot;C:\Temp\Settings.txt&quot;)<br><br>And the last one worked, the others don't.<br><br>I've searched the entire drive for files named Settings.Txt and it only finds the one in C:\Temp.<br><br>Unfortunately, I cannot guarantee that C:\Temp will exist and would rather have the file placed locally - that way administrators could open the file remotely through their browser.<br><br>m. <p>Ben Marshalsea<br><a href=mailto: > </a><br><a href= > </a><br>
 
Ben,<br>&nbsp;&nbsp;&nbsp;If it helps, you can use the FileSystemObject to get the windows temp directory. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
I've come to the conclusion that the Server object is killed before the Global.asa Application_OnEnd event is called.<br><br>Therefore the above will never work, and is why when I put a hard coded Location, instead of asking it to find the current Location of the Virtual Directory, it works.<br><br>I've solved this by putting in an Administrative screen, that Loads the settings on load - or refreshes (Still use the Application_OnStart)- and saves on Submit.<br><br>Seems to work, but rather bizarre problem in the first place.<br> <p>Ben Marshalsea<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top