(ASP) Response.Write to an executable script.

  • Thread starter Thread starter ~J~
  • Start date Start date

~J~

~J~

Soldato
Joined
20 Oct 2003
Posts
7,558
Location
London
Anyone help with a problem please.

Currently trying to fix 7 year old code after it's been moved from one server to another.

There's an ASP page which dynamically generates a block of executable code and looks like when it's Response.Write(en) to the browser, actually creates a VBS file for the server to execute.

Trouble is, all it's doing is actually writing the entire script as HTML markup and not executing.

The code is:
strEmail = BuildEmailMSG(Email,ccAddress,bccAddress,Subject,Email1Text)
Response.ContentType = "text/x-vCalendar"
Response.AddHeader "Content-Disposition", _
"filename=email.vbs;"
Response.Write strEmail
Response.End

And within IIS I have set it to run scripts AND Executables (although it was only set to Scripts and I have not restarted IIS - do I need to).

The output generated is this:

Dim objOutlk 'Outlook Dim objMail 'Email item Dim strMsg Const olMailItem = 0 Set objOutlk = createobject("Outlook.Application") Set objMail = objOutlk.createitem(olMailItem) objMail.To = "##removed##" objMail.cc = "" objMail.bcc = "" objMail.subject = "Community Times" 'objMail.attachments.add("C:\MyAttachmentFile.txt") objMail.htmlbody = "Dear ##removed##,
[letter here]

" objMail.display Set objMail = nothing Set objOutlk = nothing

Anyone any ideas on how I can get this to run or do I have to restart IIS for the changes to take effect?
 
Back
Top Bottom