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
bill201Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
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
John Gates, CISSPSecurity ProfessionalCommented:
You need to make sure the web service account has write permissions to the txt file :)
bill201Author Commented:
sorry i was wrong the host is managed by asp.net
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Big MontyWeb Ninja at largeCommented:
the code you posted is for classic asp, not asp.net

did you manage to send errors to the browser?
bill201Author Commented:
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
David Johnson, CD, MVPOwnerCommented:
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
dejaanbuCommented:
for error handling in asp.net , please follow this, this, and this
bill201Author Commented:
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.
dejaanbuCommented:
there are several ways to handle errors in asp.net, in the first link its all explained.

if you are using asp.net and only want to write the error details to a log file,then:

just create a class file named "ExceptionUtility"  and just copy and paste the code from this example .(Be sure about C# or VB Code and copy the same).

in your asp.net web page code, just import this ExceptionUtility class  and call the function "LogException" inside the  Catch Block .

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.