Link to home
Start Free TrialLog in
Avatar of bill201
bill201

asked on

problem with a web code

hi there

what is the probkem with this code, i have a file with the name log.txt and i use the code below but i get the error message 500 internal server error
<%
dim FSO,FO

FileName= Server.MapPath ("log.txt")
set FSO = server.createobject ("scripting.filesystemobject")
set FO= FSO.opentextfile (FileName,2)
fO.writeline "Hi there"

FO.close
set FSO=nothing
set FO=nothing
%>

Open in new window


this is my web site
Avatar of Big Monty
Big Monty
Flag of United States of America image

to get the exact error message, you need to send the errors to the browser by configuring IIS:

http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default

once you do that, you should get a better message telling you what's wrong
You need to make sure the web service account has write permissions to the txt file :)
Avatar of bill201
bill201

ASKER

sorry i was wrong the host is managed by asp.net
the code you posted is for classic asp, not asp.net

did you manage to send errors to the browser?
Avatar of bill201

ASKER

no i don't know how to do is, so i think to delete this message becasue i see that i have a lot holes on asp.net
Server.MapPath is the PATH to the desired file and not the file itself.
replace
FileName= Server.MapPath ("log.txt")
with

FileName= Server.MapPath (".") ' current directory
Filename = Filename & "\log.txt"

https://msdn.microsoft.com/en-us/library/ms524632%28v=VS.90%29.aspx
for error handling in asp.net , please follow this, this, and this
Avatar of bill201

ASKER

thanks David Johnson for your comment i try this, and it's not working i spoke to my web provider and he said me that my website are supporting on asp (asp classic) and asp .net.


thanks  dejaanbu for your comment
i'm sorry that i haven't responded, the truth is that i am a bit Embarrassed, because the articles on the links are difficult for me (probably i don't have enough knowledge), so i tried to take extra time to Concentrate On this articles but i haven't succeeded to understand the articles.
ASKER CERTIFIED SOLUTION
Avatar of Deja Anbu
Deja Anbu
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial