Forum Moderators: open
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
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