ASP

81K

Solutions

31K

Contributors

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a web application running in classic asp and I am currently using the crystal reports viewer to allow users to generate and download reports. My problem is I need to disable the IIS sessions and switch over to using cookies in order to handle a problem with query overlap on the web application. That is all working fine but the crystal reports viewer pages use sessions. Is there a way to run the crystal reports viewer without using sessions. Below is a sample of one of the crystal reports pages that  generate the reports.

<%@ Language=VBScript %>
<%
Dim Report_Template
Dim basepath, baseVirtualPath, iLen
Dim Param1, Param2, ParamValue2, P2, P2R, ParamValueEndRange2
Dim curValue
Dim viewer
 
basePath = Request.ServerVariables("PATH_TRANSLATED")
While (Right(basePath, 1) <> "\" And Len(basePath) <> 0)
    iLen = Len(basePath) - 1
    basePath = Left(basePath, iLen)
Wend
Response.Write basePath
baseVirtualPath = Request.ServerVariables("PATH_INFO")
While (Right(baseVirtualPath, 1) <> "/" And Len(baseVirtualPath) <> 0)
    iLen = Len(baseVirtualPath) - 1
    baseVirtualPath = Left(baseVirtualPath, iLen)
Wend

If Not IsObject(session("oApp")) Then
    Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    If Not IsObject(session("oApp")) Then
        response.write "Error:  Could not instantiate the Crystal Reports automation server.  Please check to see that Crystal Reports or ReCrystallize has been properly installed on the web server PC.  

Open in new window

0
Fundamentals of JavaScript
LVL 13
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Looking to count the number of SQL records until a certain value in one of the table columns is reached. Using Asp /VBscript. Not sure how to formulate the query.

What I'd like is to organise the results by the column "points" in descending order, grouped by the "city_id". I then need the number of records counted until a specific "member_id" is matched. Some "points" values could also be the same, which can cause an incorrect count. Similar points values should be ignored.

the db table is named "rankings" and is structured like this:

id  |  member_id  |  city_id  |  points
1   |      1      |   12500   |    2
3   |      2      |   12500   |    5
4   |     34     |     800     |    1
5   |     14     |   12500   |    14
6   |      6      |     600     |    12
7   |     11     |   12500   |    11
8   |     12     |   12500   |    5

For example, if I want to find the ranking for member_id "2", who happens to belong to city_id "12500", the correct final returned value from should be 3. This is because member_id "2" has the third highest points value in city_id "12500", even after taking into account the tie in points with member_id "12".

This below is all I can think of as I'm not a pro by any means and I know it's missing a lot!


member_id = 2
city_id = 12500
SELECT Count() as city_ranking FROM (SELECT * from rankings WHERE city_id='"&city_id&"' AND member_id <> '"&member_id&"' ORDER BY points DESC)
0
I am getting a VBScript runtime type missmatch when adding date to string to update record in MS SQL 98 database using ASP classic.. old tech i know but need use of this code, it worked when i last accessed it 4 years ago,
0
Hi there.

Setup is classic asp and MS SQL Server...
When a new record is created, I use this code to create a unique ID for the record:

(CAST('" & xpatient_group & "' AS VARCHAR(1))+CAST('" & xinstitution & "' AS VARCHAR(2))+CAST(MAX(SUBSTRING(new_temp_patient_id, 4, 6))+1 AS VARCHAR(6))+CAST('" & xregimecode & "' AS VARCHAR(2)))

Open in new window


That works just fine for ages, but I WOULD like to catch that particular value created on the server and post back to the client, so it can be used in a query string and direct the user to that particular record.
Is that possible?

Best regards

Ulrich
0
Can you make a Asynchronous call from a asp page without AJAX?
0
Hello, All.

OK, what used to work, no longer work.
A multiple row insert, will now only, insert all into a single field.

environment: Windows 10 Pro / IIS
inserting into a Microsoft Office Access Database ACCDB
(This is a site for the intranet, and not for the internet. Which is the reason for using the access database)

Code, that used to work.

The form has all TEXTAREA's that are feeding into the insert form.

arrMN = Split(Request.Form("MediaName"), vbCrLf)  
arrMF = Split(Request.Form("MediaFile"), vbCrLf)  
arrMB = Split(Request.Form("MediaBand"), vbCrLf)  
 
for i=0 to uBound(arrMN)
  Set objDoubleInsert=CreateObject("ADODB.Command")  
  objDoubleInsert.ActiveConnection=objConn  
  objDoubleInsert.CommandText = "INSERT INTO EVMediaServer (MediaName, MediaFile, MediaBand) VALUES (?,?,?)"  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaName", 200, 1, 255, arrMN(i)) 
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaFile", 200, 1, 255, arrMF(i))  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaBand", 200, 1, 255, arrMB(i))  
  objDoubleInsert.Execute  
Next

Open in new window


before, this code used to create as many rows as I had in the fields.
But now, all of it is inserted into ONE ROW, and all the lines are in one column.

What is going on?
Thanks for any and all assistance on this one.

Wayne
0
I am trying to view Crystal Reports on a new web server. We are using classic ASP, and I get the following error message when trying to view report
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/CleaningSvcsSG/reports/AlwaysRequiredSteps.asp, line 21

800401f3

Line 21 is
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")

Please help.
0
Hi all, I am having some issues with radio buttons and the auto summing/submission of these...

Here is the link of what I have
My site for testing

Now the summing of the items is not an issue, however when I submit, it grabs the wrong info (need it to grab 'iID' not 'value')
<input type=radio name="&ItemOptionGross("pitem_alt")&" value="&ProdItemOptionPrice&" iID="&ItemOptionGross("pitem_ID")&">

Open in new window


Any help is appreciated
0
Hi there.

I have a web database with classic asp, VB and javascript in the front end. I want to rebuild the entire web interface in aspx (VB edition).
I know classic asp pretty well. It's simple in the file structure. I tried starting up an aspx-project, and software like Visual Studio creates a bunch of files that is hard to overview and mess up the global web-files.
1) Is there any possible way to make a "simple" aspx-site where you control the whole thing and Visual Studio doesn't create a lot of files that are hard to overview?
2) Would it be possible to create an aspx-site on the same server as the classic asp?
3) Any free software that keeps aspx more simple than Visual Studio?

Best regards

Ulrich
0
I am using a simple web based form to submit information to an Access DB. Here is a sample of the code:

<%
Dim myConnString
Dim myConnection
Dim mySQL

myConnString = Application("MyDBTable_ConnectionString")
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open myConnString
      
mySQL= "INSERT INTO Table "
mySQL= mySQL & "(status,pub_status,...
mySQL= mySQL & Request.Form("pub_status") & "','"
...

myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing

If draft = "No" Then
...

The problem I am noticing is that every once in a while, random characters are appearing in the DB. For example the field called draft...I give the user to dropdown box to choose Yes as the box defaults to No. There's no way to specify anything besides Yes or No and as you can see from the code, I have condition statement based on which they choose. Well something happen three straight times to this users information and when I looked at the database the entry that was submitted was "Not". How did Not get into the field when the only two options were Yes or No?

I started looking around and another one of my fields which identifies which city our office was located, in this case Columbia, had entries like Columbial, ColumbiaR, Columbiae and my favorite Columbia&#10642%. This is a drop down as well. Any idea why or how these random character are getting added to the data entered.

BTW, this is a random occurrence, it does happen all the…
0
JavaScript Best Practices
LVL 13
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

I put this bit of code in and I have to admit I'm not the best at JS but I cannot see what is causing this error.
I am getting "Javascript runtime error: Function Expected"
Any help is greatly appreciated.

Here is my code:
function Search() {
        'use strict';
        $.ajax({
            url: 'Account/AccountController'(strName, strTelephone, strNum, strStreet, strApt, strZip, strIP),
            type: 'POST',
            datatype: 'json',
            cache: false,
            data: { strname: strName, strtelephone: strTelephone, strnum: strNum, strStreet: strStreet, strapt: strApt, strzip: strZip, strip: strIP },
            success: function $(status) {
                alert("Success");
            },
            error: function $(status, err) {
                alert(status + "," + err);
            }
        });
    };

Open in new window

0
Hi, Experts,
I just want to know how the hackers can penetrate my database. I am about to lunch my small project called, Daily Time Record (DTR) but I'm doubt the safety of it. The way I used to save the personnel data into my database is something like the code below. I am using Sql8. Is there anything to add to improve and keep away from hackers? Please give me some ideas.. Thanks!

<%
On Error Resume Next
dim icode,title,iname,famna

icode = request.querystring("a")
title = request.querystring("b")
iname = request.querystring("c")
famna = request.querystring("d")

db = request.querystring("db")
theServer = request.querystring("sr")


Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

cn.ConnectionString = "driver={SQL Server};server=" & theServer & ";uid=sa;pwd=3388;database=" & db & ""
cn.Open

If Err.Number <> 0 Then
   Response.Write(  Err.Number & "|" & Err.Description )
   Response.End()
end if

   cn.execute("Insert into Personnel(theCode,TheTitle,TheName,TheFamilyName) values('" & _
                         icode & "','" & title & "','" & replace(iname, "'","''") & "','" & replace(famna, "'","''") & "')")
   cn.close
	set cn = nothing

   response.write("Successfully enrolled new item!")    				      	
   response.end()
   
On Error GoTo 0
%>

Open in new window

0
Hello Experts,

In our classic asp application which serves hotel industry, when a user logs out the application, we will clear the sessions so that other system users will not able to login with the URL without logging in with the credentials.

But when the user directly closes the pop-up window or the browser tab or when the page is reloaded/refreshed we are not able to track it to clear the session. Need help on this, please.

This is the code we use:



When we use window.onbeforeunload function


 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
     
         $("li a").click(function () {
            window.onbeforeunload = null;
        });
             $("a").click(function () {
            window.onbeforeunload = null;
        });
        $("a").not('#lnkLogOut').click(function () {
            window.onbeforeunload = null;
        });
        $(".btn").click(function () {
            window.onbeforeunload = null;
        });
    });
    function getxmlobject() 
    { var x = null; 
        try { x = new xmlhttprequest(); }
        catch (e) { try { x = new activexobject("msxml2.xmlhttp"); }
            catch (e) { x = new activexobject("microsoft.xmlhttp"); } } return x; 
    }

    window.onbeforeunload = function (e) {
        debugger;
        
        if (show_close_alert) {
     
            var xmlLoginvalues = GetXmlObject();

            if 

Open in new window

0
I need to validate my invisible recaptcha in server side

I have an  native .asp file to get user data and email it,
how to validate the recaptcha in there?

<!DOCTYPE html>
<html>
<head>
    <title></title>
	<meta charset="utf-8" />
</head>
<body>

<%

      
set conn=Server.CreateObject("ADODB.Connection")
'conn.Provider="Provider=SQLOLEDB"
conn.Open "Provider=SQLOLEDB;data source=Comensaaasrios.mssql.soasaae.com;packet size=4096;user id=xxxx;pwd=xxxx;persist security info=False;initial catalog=xxxx"

sql="INSERT INTO comentarios (nombre, email,telefono, producto, comentario)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("telefono") & "',"
sql=sql & "'" & Request.Form("consultorio") & "',"
sql=sql & "'" & Request.Form("message") & "')"

on error resume next
conn.Execute sql,recaffected
if err<>0 then
  Response.Write("Error, Intente otro metodo de contacto!")
 Response.Write("<a href='http://www.oncolosdsdsjio.com'><h3>Regresar a página de contacto.</h3></a>")
else
 Response.Write("<h3>Nos pondremos en contacto lo antes posible.</h3>")
 Response.Write("<a href='http://www.oncolosdsdsbajio.com'><h3>Regresar a Oncolosdsddsdsío.</h3></a>")
       
end if
conn.close
    
%>
<%
Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Tel,ContactUs_Email
Dim ContactUs_Subject,ContactUs_Body,Action,IsError

smtpserver = "smtp.gmail.com"
youremail = 

Open in new window

0
I use Mandrill for my smtp server to send emails from my website.  We generally send race results to individual participants and coaches.  Last fall my account was hacked.  I followed Mandrill's suggestions to modify my security and they restored my account reputation and hourly send limit and all was good.  Recently I started getting emails from Mandrill indicating that my account reputation was poor and noticed that my hourly send quota was very limited.  I contacted them and was told that the initial restoration of reputation and hourly quota was a 30-day fix and it now had to "restore itself" over time.  I don't have the time.  We will be timing roughly 3000 runners on Thursday and sending them pre-race emails the day before.  Does anyone have a suggestion for another utility that I can use to send emails from my classic asp site as indicated above?  I would appreciate any help I can get.
0
I have been adding an attribute (linkToItem="TRUE") specific list item columns for some of my list views (using SPD on their ASPX files).  It works great, however if I subsequently return to the view to say add or remove a filter, the attribute gets removed (I expect that SP is regenerating the view).

Any suggestions on this would be appreciated.

Also, in the same vein,  how can I remove the hyperlink from a view column:
0
I have a long text that has this string$

.... value="variablechars" .....

or
.... value='varchars'....

I need to implement a regular expression in asp to extract these strings and create a list (each record with 2 items)

Once extracted I have no problem in creating the list in my database

the list

name1, value="str1"
name2, value="str2"
name3,value="str3"

name4,value='str4'
name5,value='str5'
name6,value='str5'

I extract email with this code (asp)

Set RegularExpressionObject = Server.CreateObject("VBScript.RegExp")
With RegularExpressionObject
 .Pattern = "[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+"
 .IgnoreCase = True
 .Global = True
 End With

 StringToSearch = blocks(x)
 set objMatches = RegularExpressionObject.Execute(StringToSearch)
 for each objMatch in objMatches
 email=objMatch.value
 next

Also extract  strings as

&nbsp;Actividad <br/>

I guess I am missing the Pattern

Example

<img src="image.png" />&nbsp;Actividad <br/><input type="text" readonly class="textboxif" style="width: 410px;" value="Name of activity" name="sector" id="sector"/></td><td>

Here the items would be

Actividad,Name of activity

I have many atrings that I have to extract the data from

Any ideas?
0
PROBLEM RESOLVED -- Pretty strange anomaly. The array names are being passed with a left paren, i.e. FieldName is FieldName(  . Pretty bizarre, but I figured it out.

I have a form that will have an unknown number of rows in it. The user is to select the rows that they want and then click the submit button. I store the values for each of the rows (they are filenames) in an array. The values are passed via POST. I can't figure out how to retrieve the array values in the receiving page. This is being written in Classic ASP.

I can do a :
For Each Item In Request.Form
    fieldName = Item
    fieldValue = Request.Form(Item)
    Response.Write fieldName & " " & fieldvalue & "<br />"
Next

and all the values are there. How do I get the passed array values assigned to elements in a receiving array so I can work with the data?
0
Hi, Experts, I wish to include AM/PM on the date base on the solution below. Thanks!

<%
d = CDate(Now)
dim dd, mm, yyyy

dim darr
darr = split(FormatDateTime(d,0),"/")

dd = darr(0)
mm = darr(1)
yyyy = darr(2)

d = mm & "/" & dd & "/" & yyyy 

response.write(d)
response.end()

%>

Open in new window

0
HTML5 and CSS3 Fundamentals
LVL 13
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Hi there, I have been looking around but unable to find specifically what I want...

I have an ASP Classic website (tables, rows, columns, not div) and I want to add expand and collapse fields

found plenty for div, but not much (that make any sense) for tables, any help on this would be great
0
Looking for a sql server/classic asp expert to look at my results code on the link below to suggest changes for efficient querying.  We have a very big day coming up soon with one event of over 6000 participants and I want to know if my code is optimized to avoid logjams.  This is something that I would be willing to entertain bids on.

https://www.gopherstateevents.com/results/cc_rslts/cc_rslts.asp?sport=Cross-Country&meet_id=505&rslts_page=overall_rslts.asp&show_indiv=n

Thank you!.
0
I have an asp page which has several fields and I got stuck at drop down button which has to populate data from a query.
But whenever I wrote some code taken from different examples from online I will get http404 error.

How to overcome it.
 my sql query is select cur_date_str,cur_effective_date from tblmovedate; where I need drop down to be filled with cur_effective_date data.

Please help me
0
I have and asp scrpit thta passes data to a php script via  post in a form.

All is ok except that whn the data passes it to large (too many bytes) I doesn't pass all the variables

As long as the amout of data remains relatively small all is ok.

I test passing the data to aan asp script and it passes it all.

Any ideas?

Thx
0
Hi, Experts, I need to know how it's possible to include in the manifest="offline.manifest" a messages from the server computer via Ajax and that message will store at the same time in the session storage and will be used during offline. I'm trying to develop an offline browser but getting difficult how to achieve that goal.  I used body onload event to trigger the Ajax and obtain the messages from the server thru ASP. <body onload="return GetMsg()"> My goal here is to retain or include the messages in the session storage and be used during offline. Any help please!  

<script>var msg;</script>
<script>
function GetMsg()
{
    debugger;
    var str = "E"
    {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() 
        {
          debugger;
            if (this.readyState == 4 && this.status == 200) 
            {
                msg = this.responseText;
            }
        };
        xmlhttp.open("POST", "GetHint.asp?q=" + str, true);
        xmlhttp.send();
    } 
}

</script>

Open in new window


The offline.manifest
CACHE MANIFEST
styles.css
jquery-1.4.min.js
offline.js
index.html

Open in new window

0
Hello

I am using class asp and in the IE i am getting this error "Object doesn't support property or method 'startRequest'". on further looking into the code, i found it that the error is from RS.HTM page , which is  a java applet....can any one help me out.
0

ASP

81K

Solutions

31K

Contributors

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.