HTML 2 ASP

By 
Liquid Diamond

<% end sub Select Case MyFunc case "New" call WriteHeader if request("NoFile") = "Y" then %> Could Not Find File

<% end if if request("NotValid") = "Y" then %> Not an HTML file

<% end if if request("Nada") = "Y" then %> You didn't enter anything

<% end if %>
Include path name eg: /FolderName/SubFolder/FileName.html
Only *.html and *.htm files are valid
Output file will be /FolderName/SubFolder/%FileName%.asp -- *WARNING* If this file exists, it will be overwritten

File to Convert:

<% case "Exec" SourceName = Request("SourceName") if Trim(SourceName) = "" then response.redirect "HTML2ASP.asp?Nada=Y&SourceName=" & Server.URLEncode(SourceName) if left(SourceName, 1) <> "/" then SourceName = "/" & SourceName tmp1 = Split(SourceName, "/") tmp3 = tmp1(Ubound(tmp1)) if right(tmp3, 5) = ".html" then for x = 0 to (UBound(tmp1) -1) outSourceName = outSourceName & tmp1(x) & "/" next outSourceName = outSourceName & left(tmp3, (len(tmp3)-4)) & "asp" elseif right (tmp3, 4) = ".htm" then for x = 0 to (UBound(tmp1) -1) outSourceName = outSourceName & tmp1(x) & "/" next outSourceName = outSourceName & left(tmp3, (len(tmp3)-3)) & "asp" else response.redirect "HTML2ASP.asp?NotValid=Y&SourceName=" & Server.URLEncode(SourceName) end if set objSource = CreateObject("Scripting.FileSystemObject") set objOutput = CreateObject("Scripting.FileSystemObject") set theOut = objOutput.CreateTextFile(Server.MapPath(outSourceName)) if not objSource.FileExists(Server.MapPath(SourceName)) then response.redirect "HTML2ASP.asp?NoFile=Y&SourceName=" & Server.URLEncode(SourceName) else Call WriteHeader response.write "" response.write "Converting File...

" response.write "Source File  =" & SourceName & "
" response.write "Physical Path=" & Server.MapPath(SourceName) & "

" response.write "Output File  =" & outSourceName & "
" response.write "Physical Path=" & Server.MapPath(outSourceName) response.write "


(File Output Dump)
--- BEGIN ---
" set objSource = Nothing set objSource = CreateObject("Scripting.FileSystemObject").GetFile(Server.MapPath(SourceName)) set theStream = objSource.OpenAsTextStream(1,-2) theOut.WriteLine "<" & "%" Do While theStream.AtEndOfStream <> True StreamLine = theStream.ReadLine if Trim(StreamLine) <> "" then StreamLine = Replace(StreamLine, chr(34), chr(34)+chr(34)) WriteStream = "Response.write " & MyQ & StreamLine & MyQ theOut.WriteLine WriteStream response.write "" & server.HTMLEncode(WriteStream) & "
" end if Loop theOut.WriteLine "%" & ">" response.write "--- END ---

File conversion complete
" theStream.close theOut.close %>

Click here to convert a new HTML file <% end if end select %>