How do I enable upload of large files in classic ASP on IIS 7?

The maxAllowedContentLength controls how much data is allowed to be sent in a response. However you want to control how much can be accepted in a request. This is handled by the maxRequestEntityAllowed attribute of the limits element in the asp section of the config file. An example might look like:- <system.webServer> <asp> <cache diskTemplateCacheDirectory=”%SystemDrive%\inetpub\temp\ASP … Read more

Parameterized query in Classic Asp

In my code, this is how I get a recordset from a command: Set rs = server.createobject(“ADODB.Recordset”) Set cmd = server.createobject(“ADODB.Command”) cmd.ActiveConnection = Conn //connection object already created cmd.CommandText = “SELECT * FROM lbr_catmaster where catname = ?” cmd.CommandType = adCmdText cmd.CommandTimeout = 900 set prm = cmd.CreateParameter(“@prm”, 200, 1, 200, “development”) cmd.Parameters.Append prm ‘ … Read more

How to output an Excel *.xls file from classic ASP

It’s AddHeader, not AppendHeader. <%@ Language=VBScript %> <% Option Explicit Response.ContentType = “application/vnd.ms-excel” Response.AddHeader “Content-Disposition”, “attachment; filename=excelTest.xls” %> <table> <tr> <td>Test</td> </tr> </table> Update: I’ve written a blog post about how to generate Excel files in ASP Classic. It contains a rather useful piece of code to generate both xls and csv files.

How to upload files with asp-classic

long time since I’ve done that but we used an upload without third party components, just two vbscript classes (solution credit goes to Lewis Moten). It looks like you can still find this “Lewis Moten solution” in the wild If you include the clsUpload file, further upload process is as simple as: Dim objUpload Dim … Read more

Classic ASP SQL Injection Protection

Stored Procedures and/or prepared statements: https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? Catching SQL Injection and other Malicious Web Requests With Access DB, you can still do it, but if you’re already worried about SQL Injection, I think you need to get off Access anyway. Here’s … Read more

How can I post data using cURL in asp classic?

You can do this using the WinHttpRequest object <% Dim http: Set http = Server.CreateObject(“WinHttp.WinHttpRequest.5.1”) Dim url: url = “https://www.instamojo.com/api/1.1/payment-requests/” Dim data: data = “allow_repeated_payments=False&amount=2500&buyer_name=John+Doe&purpose=FIFA+16&redirect_url=http%3A%2F%2Fwww.example.com%2Fredirect%2F&phone=9999999999&send_email=True&webhook=http%3A%2F%2Fwww.example.com%2Fwebhook%2F&send_sms=True&email=foo%40example.com” With http Call .Open(“POST”, url, False) Call .SetRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”) Call .SetRequestHeader(“X-Api-Key”, “yourvalue”) Call .SetRequestHeader(“X-Auth-Token”, “yourvalue”) Call .Send(data) End With If Left(http.Status, 1) = 2 Then ‘Request succeeded with a HTTP … Read more