Reputation: 682
I have a classic ASP script that opens a URL and generates the .gif provided to the local machine - this is ran every hour via scheduled tasks to 'update' the gif appropriately. Here is ourfile.asp:
<%
'The URL to get our .gif returned
url = "http://api.ourweathersite.com/api/our/api/request"
'Create our xmlhttp request
set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
xmlhttp.open ("GET", url, false)
'Send our request
xmlhttp.send
'Create a binary stream of the request and save the .gif
With Server.CreateObject("Adodb.Stream")
.Type = 1 '1 for binary stream
.Open
.Write xmlhttp.responseBody
.SaveToFile Server.Mappath("\MyIISDirectory\mygif\myresponse.gif"), 2 ' 2 for overwrite
.Close
End With
set xmlhttp = nothing
%>
I need to convert this to ASP.NET as we've recently upgraded the server that hosts this (went from 2003 box to a 2012 box with ASP.NET).
What is the best way to go about this? Is there a way to get this classic ASP running on the newer box without converting to ASP.NET?
It's not a super complex task, but I haven't been able to find much online and just changing the extension to .aspx (as expected, but was suggested somewhere) doesn't work.
Is it necessary to completely rewrite this?
Upvotes: 2
Views: 265
Reputation: 172270
Is there a way to get this classic ASP running on the newer box without converting to ASP.NET?
Yes. Classic ASP can be enabled on Windows Server 2012. A lot of tutorials can be found on the Internet; here is one of them:
Is it necessary to completely rewrite this?
No. Even if you want to go from ASP to ASP.NET, there is no need to completely rewrite this: You can keep on using the MSXML2 library (which is still present in newer Windows versions), you just need to learn VB.NET and translate your VBScript to VB.NET. This should be quite straight-forward.
Upvotes: 2