I am currently maintaining an older Frontpage 2000 website with an Access 2000 database. I have created numerous .asp update pages and would like to know how to add a time/date stamp for when I both add and modify a record. Is it possible to create some
sort of macro or code for this within the .asp page itself?
Ron
Frontpage website
CDO.SYS-Error after Windows Update
Hi, we send mails via cdo.sys. Last night the new windows-updates were installed. And now the cdo-script shows this:
"An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error."
This is my testscript:
-----------
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "my ip"
.Update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "my address"
.To = "my second address"
.Subject = "Samplemail"
.TextBody = "a little bit content"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.write "<HTML><head><title>A message has been sent.</title></head><body>A message has been sent.</body></HTML>"
%>
----------
Has anyone an idea?
Best regards
Ralf
How to find cause of Classic ASP page errors
I'm running a Windows Server 2012 R12 running IIS8.
I have a classic ASP website running on it, and for the most part it runs fine. The website gets about 1.5 million page views per month (approx 400,000 unique page views).
I have a custom error page for 500.100 script errors, which stores details about the error in a database and sends me an email so I know if a page errors.
I have them set up via this in web.config:
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL"><remove statusCode="500" subStatusCode="100" /><remove statusCode="500" subStatusCode="-1" /><remove statusCode="404" subStatusCode="-1" /><error statusCode="404" path="/error_404.asp" responseMode="ExecuteURL" /><error statusCode="500" prefixLanguageFilePath="" path="/error_500.asp" responseMode="ExecuteURL" /><error statusCode="500" subStatusCode="100" path="/error_500.asp" responseMode="ExecuteURL" /></httpErrors>
On the error_500.asp the page includes this code:
On Error Resume Next Response.Clear Dim objError Set objError = Server.GetLastError() set objError = Server.getLastError() strNumber = objError.AspCode strSource = objError.Category strDesc = newstr(objError.Description) strCode = newstr(objError.Source) strLine = ObjError.Line strASPDesc = ObjError.ASPDescription strRemoteAddr = Request.ServerVariables("REMOTE_ADDR") ref = request.servervariables("HTTP_REFERER") str = request.servervariables("QUERY_STRING") cookies = request.servervariables("HTTP_COOKIE") ip_url = strRemoteAddr ua = newstr(request.servervariables("HTTP_USER_AGENT")) totalstring = objError.File & "?" & str
For some reason, I often get errors like this:
strNumber: strSource: strDesc: strCode: strLine: 0 strASPDesc: strRemoteAddr: 98.168.145.166 ref: http://example.com/content/another-page.asp str: 500;http://example.com/content/this-page.asp cookies: ASPSESSIONIDQQRTDDBQ=IBBOMHEDGEEGKAPPLDGLDHLE; _ga=GA1.3.1626071938.1497868025; _gid=GA1.3.629715385.1497868026; _gat=1; __gads=ID=c83d077246e96531:T=1497868028:S=ALNI_MY2v7GwftRZ5EMHIdi_5lEA8TDAgQ ip_url: 98.168.145.166 ua: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 totalstring: ?500;http://example.com/content/this-page.asp
So I can see the page is erroring, but there is no error message, or line number, or anything else.
I don't know how to find out more about these errors, and wondered if anyone might be able to advise please?
Sometimes I have had up to 10,000 of these all at the same time, which I presume is a hacking attempt, but I am not sure how I can run more detailed debugging etc?
I don't want to log everything on the site as it might fall over if I start doing that, possibly?
Any advice would be much appreciated.
Thanks!
Runnin an external .VBS file?
Hi all :)
I have a responsive web site, where any user can upload pictures. When anyone does, I automatically create no less than 45 different versions of that image. CREATING those images might take up to 10 minuttes, if the user uploaded .RAW files.
So...I'd like to start off an external .VBscript file, which does all the work in the background. But...despite being able to start calc.exe - I'm not able to start a .VBS, nor cscript.exe or wscript.
Has anyone else tried starting an external program - in classic ASP? If so...how?
PS - I'm using Windows Server 2016 with IIS 10, on my own server.
Example at http://www.computerperformance.co.uk/vbscript/wmi_process_start.htm
DefaulApplicationPool and SSRS ReportingService2010 management webservice
I am using SSRS webservice to publish my reports. In order to access the webservice I am granting my machine account to access reports. Particularly I am giving it a Content Manager role. When Report Server is running on a different than my iis box DefaulApplicationPool needs to use Network Service to make it work. But when both iis ans SSRS server are on the same machine seems like Network Service is not enough and I have to use Local System. Is there any problem with using Local System in real customer environment? And if yes what are my options?
Thanks
IIS doesnt execute classic asp code server side includes
Classic ASP / IIS 7 configuration problem
I’m trying to create and configure a classic asp site under IIS on a WIndows10, first in a test environment with the intent of later running in a production environment after the test site works. This same site runs in production on Windows 2003 servers under
IIS6.
My current problem is that the asp code itself is being served up, instead of being processed as asp code. It seems that a missing or mis-configured handler is the likely culprit, but I’m at a loss to figure out exactly what that might be.
I have taken the following steps thus far:
1) Installed the ASP, ISAPI Extensions, ISAPI Filters, and Server Side Includes
2) In the ASP feature,
a. Set Enable Parent Paths = True
b. Set Send Errors to Browser = True
3. Have following handler-mapping
Name:ASP *.asp - ServerSideIncludeModule - Executable-%windir%\system32\inetsrv\asp.dll
static html runs without any problems.
Any advice or insights would be greatly appreciated.
Thanks,
ASP unresponsive and not reporting a meaningful error
We have a combination of ASPX and classic ASP on a site we have been maintaining for years.
A few days ago after tweaking web.config and restarting IIS, my development site has stopped responding to ASP pages and I am unable to locate meaningful errors indicating what is wrong.
Login is thru an ASPX page but when it transfers to a feature on a ASP page, network traffic shows the POST with state Pending. After several minutes it stops waiting and shows status Aborted, and the page shows: This page can't be displayed, while the event log shows that the app pool worker process was recycled "because the worker process reached its allowed processing time limit."
Event log for IIS-Configuration shows a number of warnings and errors for C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\web.config
- Warning: Unable to find schema for config section 'system.serviceModel/serviceHostingEnvironment'. This section will be ignored.
- Warning: Unable to find schema for config section 'system.xaml.hosting/httpHandlers'. This section will be ignored.
- Error: An error has occured: Unrecognized element 'providerOption'
and a bunch of others. Will this be causing ASP processing to fail?
Where is the best guide for tracing what is going on, or can I enable detailed logging for IIS or ASP?
How to use CNG KSP to generate DSA keys using the Legacy CertEnroll API
Hi,
I'm creating an Internet Explorer solution which is capable of generating X509 PKCS10 enrollment requests. My solution makes use of the WebEnabled VBScript functions of the CertEnroll API.
I've managed to get the newer Cryptography API: Next Generation (CNG) Microsoft Key Storage Provider (KSP) to generate enrollment requests containing RSA and ECDSA Keys of various sizes. I've tried to modify the same method to use DSA keys in the enrollment requests, but I have been unsuccessful in getting this to function as expected.
According to the MSDN CNG documentation, the KSP should be able to generate DSA keys of sizes 512 to 1024 in 64-bit increments: https://msdn.microsoft.com/en-us/library/windows/desktop/bb931355(v=vs.85).asp
I have managed to generate DSA keys, but I have been unable to use/access them in the Legacy CertEnroll API. I know that my implementation does indeed create DSA keys for two reasons. Firstly, the key-generation pop-up window appears asking the end-user if they wish to use a password to protect the key-pair being generated. Secondly, the Windows Event Viewer contains entries in the 'Windows Logs > Security' section which confirm DSA keys were generated. The log entries in the event viewer are the same for RSA, ECDSA, and DSA. However, attempting to generate a certificate enrollment request with DSA keys results in an empty enrollment request. In fact, any attempt I make to access DSA keys results in null/blank/empty results.
My code is based on the sample CertEnroll API code which accomplishes a similar task using Legacy CSPs. I've included a sample excerpt of my code below:
Dim algObjectIdDim X509PrivateKeyDim X509CertificateRequestPkcs10Dim X500DistinguishedNameDim X509Enrollment'initialize variables to be blank objects for now.Set X509PrivateKey = Enroll.CreateObject("X509Enrollment.CX509PrivateKey")Set algObjectId = Enroll.CreateObject("X509Enrollment.CObjectId")Set X509CertificateRequestPkcs10 = Enroll.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10")Set X500DistinguishedName = Enroll.CreateObject("X509Enrollment.CX500DistinguishedName")Set X509Enrollment = Enroll.CreateObject("X509Enrollment.CX509Enrollment")'Initialize the algObjectID variable based on Algorithm NameCall algObjectId.InitializeFromAlgorithmName(0,0,0,"DSA")'Initialize the Provider name, Algorithm, and Length X509PrivateKey.ProviderName="Microsoft Software Key Storage Provider" X509PrivateKey.Algorithm = algObjectId X509PrivateKey.Length =512'Encode the cn (defined elsewhere in code) as an X509DistinguishedName object.Call X500DistinguishedName.Encode(cn,XCN_CERT_NAME_STR_NONE)'Initialize the Certificate Request from private key. Set the DN of the cert request.Call X509CertificateRequestPkcs10.initializeFromPrivateKey(ContextUser,X509PrivateKey,"") X509CertificateRequestPkcs10.Subject = X500DistinguishedName'Initialize an X509 Enrollment Request from the X509CertificateRequestPkcs10.Call X509Enrollment.InitializeFromRequest(X509CertificateRequestPkcs10)'Create the request: This is where the keys get generated. pkcs10req = X509Enrollment.CreateRequest(CRYPT_STRING_BASE64)'The pkcs10req variable is empty only when DSA keys are used for the algorithm
I'm looking for any help/advice I can get to resolve my issue. I've been stuck on this issue for way too long.
IIS ASP ScriptTimeout
Hello,
I am having an unexplained issue with setting a scripttimeout.
In IIS it's set to a minute and a half.
But when i make a request, it times-out after about 5 minutes.
I have an ajax application.
I make a jquery ajax request (the ajax request's timeout is also a minute and a half)
The browser successfully cancels the request after that amount of time, but the request is still executing on iis for a few minutes (verified using performance monitor asp counters)
I suspect the issue is with a com object i'm using.
It's a c++ dll that sends all the requests to the DB. I think that it's keeping the request open regardless of wheather or not the browser has closed the connection, and that also makes the asp scripttimeout value not do anything.
Can someone shed some light on this issue?
DLL works in debug mode
We are running a 2003 server with IIS 6 or 7 and have a dll which uses the win32 api. The dll is written in vb6. To debug the code in a browser we set integrated windows authentication so we can step through it. When we compile the dll and run enabling anonymous access the api call findwindow doesn't work. The hwnd for the process returned is 0. The hwnd returns a proper long with integrated windows authentication. It's seems like the IUSR or IWAM account which accesses the dll doesn't have access to the winAPI but the windows user has access. Does anyone know what we can do in either IIS or the OS so when live (enabled anonymous access) the IUSR or IWAM account can run these functions and return the hwnd to a process? Any help would be much appreciated!
Cookies: HTTP and SSL Only in IIS 10- Classic ASP
Hi again everyone.
I'm trying to find out how to set cookies as HTTPOnly and SecureOnly in CLASSIC ASP.
Nothing I do seems to fix it. I've tried all kinds of tricks in my ASP, web.config (only for .net I think), etc all to no avail.
Thanks
Matt
SQL executing twice in IIS10 with ASP Classic
I have a new dev/test environment that is in IIS 10 (with asp classic as api) and SQL Server 2016. Today, I noticed that some posts was doubling records in the database. Upon further review, the IIS logs only show one request, but SQL Trace shows 2 concurrent SQL:BatchCompleted traces for every call to the database using the unsecure
cn.execute "stored_procedure 'param1'"method, but any database call that is with a prepared statement only has one RPC:Completed hit in the trace and is performing like normal.
Our production environment has the same SQL version, but is still in IIS6, currently. I lost my dev IIS box with the same setup a couple weeks ago and hadn't noticed this before. About 90% of our API has been in use in production for over a decade without this happening, and it is not happening now.
I am a little new to IIS 10 as I have been maintaining the IIS6 environment this whole time, so perhaps I have configured something wrong, but other than enabling ASP classic and parent paths, I haven't modified much to get our legacy API running.
Sample of ASP that is causing double executions:
dim cn dim dbConnectionString dim SQL dim rs dbConnectionString = "Provider=SQLNCLI11;Server=srvr\instance;Database=DB;Uid=user;Pwd=pass;" Set cn = Server.CreateObject("ADODB.Connection") cn.open dbConnectionString cn.CommandTimeout = 0 SQL = "store_procedure_name 'paramValue'" set rs = server.CreateObject("ADODB.Recordset") RS.Open SQL, cn, adOpenStatic, adLockReadOnly Response.Write( rs(0) ) rs.Close set rs = nothing Response.end
And using an ADODB prepared statement results in normal execution:
Dim cmd Set cmd = Server.CreateObject("ADODB.Command") With cmd .ActiveConnection = cn .CommandType = adCmdStoredProc .CommandText = "StoredProcedureName" .CommandTimeout = 0 End With
What am I missing that has been driving me insane all day? The majority of the API uses the less secure string method (I am aware of SQL injection, etc.) as we haven't been allotted the time to refactor to prepared statements. However, All new code is written with prepared statements.
I have even created a second site from scratch to see if it was a configuration setting - same thing is happening.
Parse XML in classic ASP
I'm trying to parse XML in classic ASP. The following code displays the XML file sequentially. How do I randomly access the fields <Product> and <SKU>? I've been trying to use getElementsByTagName method although I'm unable to get this working properly.
<% Dim mydoc Set mydoc=Server.CreateObject("Microsoft.XMLDOM") mydoc.load(Server.MapPath("xml.xml")) set nodes = mydoc.selectNodes("//*") for i = 0 to nodes.length - 1 response.write(nodes(i).nodeName & " - " & nodes(i).text & "<br />") next %> xml file -------- <?xml version="1.0" standalone="yes"?><NewDataSet><Table><Product>Test1</Product><SKU>AAA</SKU></Table><Table><Product>Test2</Product><SKU>BBB</SKU></Table></NewDataSet>
Classic ASP and Windows 2012 IIS Slow Performance
I updated the Windows 2003 server to the 2012 server. Pages using classic asp started to opening too late. All server resources are normal. CPU, memory below 50%. I think there must be a iis trick to do but I can't find it. Anybody help me?
Global.asa and 4 different sites
Hi
I'm running win10 on my pc, where I have ISS installed. I do manage 4 websites and I test them locally on my pc. It works fine.
Recently I have made individuals global.asa for the 4 sites (domains, applications), since I want each individual site to have its own global.asa
But where shall I install it?
In the old days (2 weeks ago) I had alle 4 websites placed directly under inetpub/wwwroot together with a common global.asa. It worked perfectly as long as all 4 websites could use the same global.asa.
Now I have moved the files so they are situated parallel. I have moved the files belonging to domain1 from inetpub/wwwroot to netpub/wwwroot/domain1 and made the same for the other 3.
In ISS I have also declared 4 new websites each with the name domain and physically placed under inetpub/wwwroot/domain, i.e. I have now
inetpub/wwwroot/domain1
inetpub/wwwroot/domain2
inetpub/wwwroot/domain4
And I have now the 4 different global.asa - one in each folder.
However my files can not see the global.asa. If i run index.asp under domain2 it can not show me the calls to global.asa. But if I move the global.asa from inetpub/wwwroot/domain2/global.asa one level up to inetpub/wwwroot/global.asa it can be seen. But this means that all four applications are controlled by the same global.asa and not their own global.asa, so this is not what I want.
So it looks as the root for domain2 is not - as I had hoped - inetpub/wwwroot/domain2, but stil the old place inetpub/wwwroot
What am I doing wrongly og what do I miss to do?
Best regard and hoping for help
/jens
Access 2010 with Classic ASP connection failed
I am trying to connect Access 2010 with Classic ASP. I am getting following error. I have already installed MS Access driver. Here is my code ' 2010 ACCDB strConn="Provider=Microsoft.Jet.OLEDB.12.0;Data Source=c:\inetpub\wwwroot\msaccess2010.accdb;Persist Security Info=False;" 'Create the object Set objConn = server.CreateObject("ADODB.Connection") 'Open the connection to the database objConn.ConnectionString = strConn objConn.Open It is showing error ADODB.Connection error '800a0e7a' Provider cannot be found. It may not be properly installed. /Updates/classicASP.asp, line 112
IIS Settings:
.Net Framework (I have tried all options) v2.0 or v4.0 or 'no managed code' (v2.0 is recent)
Enable 32 bit (none work) true or false (true is recent)
Load user profile: (none work) true or false (false is recent)
WebService Error
Hi there,
I have a WCF WebService that is running fine in the prduction.
I migrated it to my local machine for tests, by zipping the entire folder, and installing it in my local IIS.
The service is running fine, when I navigate to the service page: http://localhost:8085/
Using the same method / operation locally - return a Request Error:
<div dir="ltr">
The server encountered an error processing the request. Please see the service help page for constructing valid requests to the service. The exception message is 'The type
initializer for 'Microsoft.Practices. Server stack trace: at System.Threading.Thread. |
What else needs to be done please ?
Select unique values from radio buttons
Hello friends:
I tried to create a radio button to get its unique value for each question in SubCat table and store these values in a new table.
How do I fix my code to get its unique value for Report table. For example, when I check on the first Radio for South, then I get a value "1" in the DB Report table. If I check on the second Radio for North, then I get a value of "2" in the DB Report table.
Currently, I got values for '0' for all fields. The output will be as below:
I tried to create a radio button to get its unique value for each question in SubCat table and store these values in a new table.
How do I fix my code to get its unique value for Report table. For example, when I check on the first Radio for South, then I get a value "1" in the DB Report table. If I check on the second Radio for North, then I get a value of "2" in the DB Report table.
Currently, I got values for '0' for all fields. The output will be as below:
Here is my new table for Report:
ReportID CategoryID SubcatID Scale
------------------------------------------
1 01 1 1
2 01 2 2
Category table
CategoryID Category
------------
01 cat
02 cat2
03 cat3
Subcat table
SubcatID Subcat Category_id
-------------------------
1 south 01
2 north 01
3 east 02
4 west 02
5 line 03
ASP Code:
If Request.Form("FormSource") = SubmitForm" Then
sReportID = Request.Form("ReportID")
sCategoryID = Request.Form("CategoryID")
sSubcatID = Request.Form("SubcatID")
sScale = Request.Form("Scale")
SQL = "SET NOCOUNT ON;" &_
INSERT INTO Report (ReportID, CategoryID, SubcatID, Scale) VALUES " &_
"('" & SCategoryID & "', '" & SSubcatID & "', '" & SCategoryID & "', '" & SScale & "');" &_
SELECT @@IDENTITY AS ReportID"
Set objRS = objCon.Execute (SQL)
sReportID = objRS.Fields("ReportID").value
objRS.Close
End If
<form action="" method="post" id="newCategory">
<table>
<tr>
<td>Category and sub</td>
<td>Pass</td>
<td>Fail</td>
<td>NA</td>
</tr>
<%
currCat = ""
sSQL = "SELECT s.*, c.* FROM Category c, Subcat s WHERE s.Subcat_id = c.Subcat_id "
objRS.Open sSQL, objCon
response.Write sSQL
Do Until objRS.EOF
sCategory = objRS("Category")
sSubcat = objRS("Subcat")
if currCat <> sCategory Then
currCat = sCategory
%>
<tr><td><%=sCategory%></td></tr>
<input type="hidden" name="CategoryID" size="40" maxlength="50" value="<%=sCategory%>">
<%
End If
%>
<tr><td><%= sSubcat %></td>
<input type="hidden" name="SubcatID" size="40" maxlength="50" value="<%= sSubcat %>">
<td><input size="20" type="radio" name="<%=sCategory%>" value="1"></td>
<td><input size="20" type="radio" name="<%=sCategory%>" value="2"></td>
<td><input size="20" type="radio" name="<%=sCategory%>" value="3"></td>
</tr>
<%
objRS.MoveNext
Loop
objRS.Close
%>
</table>
<input type="hidden" name="FormSource" value="CatSubmit">
<input type="button" value="Update" onclick="submitForm();">
</div> </div>
How to get unique values from radio button and hidden input
Hello friends:
I tried to create a radio button to get its unique value for each question in SubCat table and store these values in a new table.
How do I fix my code to get its unique value for Report table. For example, when I check on the first Radio for South, then I get a value "1" in the DB Report table. If I check on the second Radio for North, then I get a value of "2" in the DB Report table.
Currently, I got values for '0' for all fields. The output will be as below:
I tried to create a radio button to get its unique value for each question in SubCat table and store these values in a new table.
I checked Radio 1, 2 and 3.
I received all '0' for CategoryID, SubcatID and Scale.
It seems like not capture any values from NOT only radio buttons but hidden INPUT as well.
How do I fix my code to get its unique value for Report table. For example, when I check on the first Radio for South, then I get a value "1" in the DB Report table. If I check on the second Radio for North, then I get a value of "2" in the DB Report table.
Currently, I got values for '0' for all fields. The output will be as below:
Here is my new table for Report:
ReportID CategoryID SubcatID Scale
------------------------------------------
1 01 1 1
2 01 2 2
Category table
CategoryID Category
------------
01 cat
02 cat2
03 cat3
Subcat table
SubcatID Subcat Category_id
-------------------------
1 south 01
2 north 01
3 east 02
4 west 02
5 line 03
ASP Code:
If Request.Form("FormSource") = SubmitForm" Then
sReportID = Request.Form("ReportID")
sCategoryID = Request.Form("CategoryID")
sSubcatID = Request.Form("SubcatID")
sScale = Request.Form("Scale")
SQL = "SET NOCOUNT ON;" &_
INSERT INTO Report (ReportID, CategoryID, SubcatID, Scale) VALUES " &_
"('" & SCategoryID & "', '" & SSubcatID & "', '" & SCategoryID & "', '" & SScale & "');" &_
SELECT @@IDENTITY AS ReportID"
Set objRS = objCon.Execute (SQL)
sReportID = objRS.Fields("ReportID").value
objRS.Close
End If
<form action="" method="post" id="newCategory">
<table>
<tr>
<td>Category and sub</td>
<td>Pass</td>
<td>Fail</td>
<td>NA</td>
</tr>
<%
currCat = ""
sSQL = "SELECT s.*, c.* FROM Category c, Subcat s WHERE s.Subcat_id = c.Subcat_id "
objRS.Open sSQL, objCon
response.Write sSQL
Do Until objRS.EOF
sCategory = objRS("Category")
sSubcat = objRS("Subcat")
if currCat <> sCategory Then
currCat = sCategory
%>
<tr><td><%=sCategory%></td></tr>
<input type="hidden" name="CategoryID" size="40" maxlength="50" value="<%=sCategory%>">
<%
End If
%>
<tr><td><%= sSubcat %></td>
<input type="hidden" name="SubcatID" size="40" maxlength="50" value="<%= sSubcat %>">
<td><input size="20" type="radio" name="<%=sCategory%>" value="1"></td>
<td><input size="20" type="radio" name="<%=sCategory%>" value="2"></td>
<td><input size="20" type="radio" name="<%=sCategory%>" value="3"></td>
</tr>
<%
objRS.MoveNext
Loop
objRS.Close
%>
</table>
<input type="hidden" name="FormSource" value="CatSubmit">
<input type="button" value="Update" onclick="submitForm();">
Thank you!
How to send email with IIS SMTP?
Hi,
I'd like to know how to use IIS smtp to send e-mail with my classic asp application? Could you provide the steps to enable smtp in classic asp? It would be better if you could provide a sample code. Thanks in advance.