Forum Moderators: open

Message Too Old, No Replies

Maddening stupid simple problem

Pathname syntax...

         

Harley_m

4:55 pm on Apr 30, 2003 (gmt 0)

10+ Year Member



Hi,

if i want to write a pathname to a file, say a text file on the root of the folder the main application sources files are - i would write it either the whole local pathname - or just 'Textfilex.txt' - both with work locally - as seen below...

Dim SpecialOfferBox1 As String = "SpecialOfferBox1.txt"
If File.Exists(SpecialOfferBox1) Then
Dim LNBsr1 As StreamReader = File.OpenText(SpecialOfferBox1)
Dim LNBinput1 As String
Box4.Visible = True
LNBinput1 = LNBsr1.ReadLine()
Box4Label.Text = LNBinput1
End If

this works 100% fine on the local machine im building on - now comes the stupidly simple question - how can i get it to point to the same file, but uploaded to the root of a web folder? - the above sample doesnt work - nor does any combination of //'s and /'s i know of!

i must be the most stupidly simple thing - it works fine for images - writting there paths as absolute - but for files like this - and other times i call files - i dont have the correct syntax?

what is it?

excuse my stupidity!

Harley

korkus2000

7:22 pm on Apr 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried adding a mappath in front of it?

Harley_m

3:35 am on May 1, 2003 (gmt 0)

10+ Year Member



what - like :

Dim LatestNewsBox As String = Server.MapPath("SpecialofferBox1.txt")?

yes - works on the local one - but again, not once ive uploaded

this is ridiculous! - how would you reference a file from code that works on a server?

it isnt anything complicated - its not even a bug or a problem - i just dont know the correct syntax!

please help!

Harley

le_gber

9:14 am on May 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dim LatestNewsBox As String = Server.MapPath("SpecialofferBox1.txt")?

I THINK it's something like:
Server.MapPath("/pathToFile/SpecialofferBox1.txt")

so if your file is on the root it's

Server.MapPath("/SpecialofferBox1.txt")

Let us know if it works.

Leo