c# - StreamReader Server.MapPath - Physical path given, virtual path expected -
im trying .net website read first line in text file shows status of computer located on. old "server.mappath - physical path given, virtual path expected" if remove server.mappath, fixes problem on server, errors on clients computer because seems trying access file on clients pc. here snippet:
streamreader streamreader3 = new streamreader(server.mappath(@"c:\\status\\status.txt")); textbox2.text = streamreader3.readline(); streamreader3.close() i know fix issue moving file called same folder webpage, , have server side program update file there, there way otherwise? thanks.
mappath translates paths starting ~ full local path. not need in code.
if file supposed @ fixed place time, open in directly full path.
if relative site root, use server.mappath("~/status.txt")
Comments
Post a Comment