We help IT Professionals succeed at work.

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.

Hi there.

I have this table where I want to hide specific rows until a specific value is chosen from a Select-panel.
I can hide a textbox or other elements, but my code doesn't work for a table row. Any idea why?
Here's the Javascript:
<script type="text/javascript">
function Check() {
   if (document.getElementById('mm_comor_infectious_choice').value == "Yes") {
        document.getElementById('a1').style.display = 'block';
    } 
    else {
        document.getElementById('a1').style.display = 'none';

   }
}

</script>

Open in new window


Here's the div-tags I "wrap" around the <tr></tr> in a table to hide it all until "Yes" is selected from the dropdown menu below:
<div id="a1" style="display:none" >
</div>

Open in new window


Select-panel:
<select name="mm_comor_infectious_choice" id="mm_comor_infectious_choice" onchange="Check();">
        <option value="na" selected="selected"></option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
      </select>

Open in new window


What's the trick to make it work? As mentioned: If I wrap a single element with the div-tags, then it works fine.

Best regards

Ulrich
0
We currently use ASPUpload and DropZonejs  to drag and drop files and then upload them to our server.

We are looking for a compatible script that will ZIP (compress) the files after the user drags and drops them in the "DropZone", and create one zip file which is the one that would be uploaded using ASPUpload.
Any recommendations on a script that would do this?

We need this for ASP Classic and also for NetCore.
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
javascript error
Not sure if I'm just being silly, but can't seem to get this script to work

function GetIP()
{
    var strIP
      strIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR");
    If strIP = "" Then strIP = Request.ServerVariables("REMOTE_ADDR");
    IP = strIP;
      document.form1.User_IP.value = IP;

}
0
My predecessor programmed our Intranet using ASP ages ago. There's code on a form submittal where it's using an Update statement to take away from the number showing in the database:

myConnString = Application("Flash_ConnectionString")	
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open myConnString
	
mySql="UPDATE OnHand SET ohnum = ohnum - 1 WHERE ohnum > 0"
  
myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing

Open in new window


This works fine but we have since changed things to where the form allows the person to put any number for this item that we still need to subtract from the DB.

To make things easier, I call the value from the form and assign it to the variable s16: s16 = Request.Form("size16")

Then I try to get the Update statement to use my s16 var rather than the static number (mySql="UPDATE OnHand SET ohnum = ohnum - s16 WHERE ohnum > 0") and the web page returns this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/flash/Confirm.asp, line 233

Open in new window


Some things I do know:
1. Both ohnum and size16 are a Number data type in the Access DB
2. Via a Response.Write Command, I verified that the variable s16 does carry the correct information.

It's probably some kind of text/number mismatch but I cant seem to figure it out.

I have zero training with ASP so be gentle :)
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
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
Experts - Can someone give me code samples for Classic asp with EWS connection please?

Classic asp and not .Net
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
I use the following asp net email validator and it works fine until today I get an email (jsmiths@ca--homes.com).
And I want to ensure to accept this string '--'.

how can I do that with my current email validator?


<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
            ControlToValidate="NewEmailAddressTextBox" CssClass="red bold"
            Display="Dynamic" ErrorMessage="*"
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
            ValidationGroup="AddNewEmail"></asp:RegularExpressionValidator>
0
I am trying to create 2 web pages using Classic ASP. I know it's outdated now, but I used to write in it many years ago, and have mostly forgotten it all. It's just for a way of displaying all of the video files I have for each tape. So one tape (tbl_tape) will have many video file (tbl_video_file), linked by tape_id - fk_tape.

Page 1 - (list_tapes.asp) just needs to create a dropdown populated from tbl_tape. I am familiar with how to do this part, so you can skip all of the table set up and SQL statements. This will produce a field called "tape_id". But I can't work out how to retrieve this value from the dropdown.
Then ideally, each item in the dropdown is a hyperlink to the next page, which is passed the tape_id. So you press the relevant tape ID in the dropdown and it then goes to Page 2. So from memory, it will need a hyperlink of "list_files.asp?file_id = 3"

Page 2 - (list_files.asp) just need to list all of the video files for the value of tape_id sent from Page 1. Again I can do all of the SQL side of this, I just need to know how Page 2 references the value sent to it, which will be fk_tape
0
I am trying to utilize this piece of classic asp code and am getting errors:
<a href='javascript:delay(Update.asp?c=" & request.QueryString("c") & "&g=" & request.QueryString("g") & "')>

Open in new window

I only get errors when request.QueryString("g") contains a space:

Invalid left-hand side in assignment

Below is the function:
<script>
	function delay (URL) {
	setTimeout( function() { window.location = URL }, 500 );
	}
</script>

Open in new window


Thoughts?
0
I'd like to remove quotation marks from the "username" field before it is submitted.
Can this be done with JavaScript ?
0
I have a simple stored procedure which generates insert statements, and I want to know how to execute them automatically.

I am calling this stored procedure from a button on a Classic ASP page., which is the reason for wanting the INSERT statements to be executed after they are created.

In its simplest form,  here is the statement that generates the INSERT statements :

SELECT 'INSERT INTO DEV_Test (''' + txtSchoolID + ''', '''', '''', '''', '''' )' FROM DEV_Test2

Open in new window


… and this is what is produced :

INSERT INTO DEV_Test ('150721346050', '', '', '', '' )
INSERT INTO DEV_Test ('3456407213', '', '', '', '' )
INSERT INTO DEV_Test ('3721313250', '', '', '', '' )
INSERT INTO DEV_Test ('3721388839', '', '', '', '' )

Open in new window


… and I want the stored procedure to execute these statements.

Can anyone help?

Thank you

Jim
0
I installed parallels in a MacOS and then installed Windows 10.
We run a simple ClassicASP Application on the local IIS for development purposes.  It uses a few third party plugins.

We have the exact same configuration on another computer and it works just fine there, but on this install of Windows 10 when we try to use any of the plugins I get the following error:

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 

Open in new window

0
I am trying to work with Thread.CurrentPrincipal and need some help with that. Never used that before so any help will be helpful.

this is what i have so far.

            interface IAmSomething
            {
                  bool something(string role);
            }

public async Task<IActionResult> Index()

{
var haveRole= Thread.CurrentPrincipal as IAmSomething;

if (haveRole.something("some_string_value"))
{
}

I just need to test for now by hardcoding some values so what should i do in order for the if statement to work. as expected if statement is throwing a null exception .
0
Hi all, I am lost to how to make this work... or to describe it

the code:
<%
Set PackageOption=oConn.Execute("SELECT * FROM enq_items WHERE land_ID=1251 AND item_type=35")
%>
<td width=10% align=center rowspan=2><input type=hidden name=itemID value=5280><select name=packageID>
<%
Do Until PackageOption.EOF
%>
<option><%=PackageOption("item_ID")%></option>
<%
PackageOption.MoveNext
Loop
%>
</select><br><input type=submit name=package value='Add'></td>
<%

Open in new window

Submit Code:
oConn.Execute("UPDATE enq_items SET item_package="&Request.Form("packageID")&" WHERE item_ID="&Request.Form("itemID"))

Open in new window

error:
UPDATE enq_items SET item_package=5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434 WHERE item_ID=5280, 5279, 5281, 5283, 5282, 5284, 5289, 5285
Microsoft JET Database Engine error '80040e14'

Syntax error in UPDATE statement.

/process.asp, line 955

Open in new window


As you can see its grabbing multiple packageIDs & itemIDs, how do i get it to grab just 1 of each?
0
This is not really a problem - yet. It is merely me trying to understand how to secure my code from sql injection. I'm using classic asp as it's all I know.

As far as I understand using stored procedures within my mysql database and then  calling these procedures would be the way forward. I'd like to get this working.
I was directed towards this web-page in an earlier question: https://www.mikesdotnetting.com/article/5/saved-parameter-queries-with-ms-access-and-asp

However this concerns an MS access database, and I can't get it to work in my mysql database (for obvious reasons I guess).

Let's assume that I have table MyTable with the followong fields: Id (mediumint), GUID (varchar), Name (Text), DateInserted (Datetime), Comments (Text) (DateTime), Status (mediumint)

I need to read from, update, insert and delete in this table.
I would need to create stored procedures for this, right? I can't seem to find a way to do that using phpMydAdmin (which is what I got and will use, regardless). How would I create these procedures?

Remember that this has to work with classic asp.
Best regards
Michael
0
I'm using asp.net web forms and visual basic.

On my page i have a ASP Textbox.

I'm using the TextChanged event.

This is my code:

    Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs)


        HiddenField_TextBox1Changed.Value = TextBox1.Text

    End Sub

So when I type some text in the textbox, the textchanged event is saving the value I typed in the textbox, to a hidden field.

What's the equivalent to the TextChanged event of a textbox using JavaScript instead of Visual Basic?
1
Hi everyone!

At my wits end here. I have this code:
<%
Dim UserIPAddress
UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserIPAddress = "" Then
  UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
End If



  userNow = Session("Bruger")
  
  SQLStr = "SELECT * FROM USERDATABASE WHERE Bruger = '" &  userNow & "'"
  Set RSDatabase = DATABASE.Execute(SQLStr)
  UserId =  RSDatabase("UserId")
  Admin =  RSDatabase("Navn")

GUID = Request.querystring("GUID")


   '*** Find brugernavn & adgangskode
    SQLmaal = _
     " SELECT "				&_
	"  *     "			&_
	" FROM   "			&_
	"  DATABASE "			&_
"  WHERE "			&_
"  GUID = " & GUID & "  "	

   Set RSDatabase = DATABASE.Execute(SQLmaal)

   GUID = RSDatabase("GUID")
id = RSDatabase("Id")
   navn = RSDatabase("Navn")
   Lokale = RSDatabase("Lokale")
   Email = RSDatabase("Email")
   tlf = RSDatabase("tlf")
   udstyr = RSDatabase("Udstyr")
   filepath = RSDatabase("filepath")
   Beskrivelse = RSDatabase("Beskrivelse")
   Datomodtaget = RSDatabase("Datomodtaget")
   Datoafsluttet = RSDatabase("Datoafsluttet")
   Bemaerkninger = RSDatabase("bemaerkninger")
   Sagsnr = RSDatabase("Sagsnr")
   Lokation = RSDatabase("Lokation")    



      

If DateM <> "" Then
a = Year( DateM ) 

b = Month( DateM )
if CInt( b ) < 10 then b = "0" & b

c = Day( DateM )
if CInt( c ) < 10 then c = "0" & c

j = Hour( DateM )
if CInt( j ) < 10 then j = "0" & j

e = Minute( DateM )
if CInt( e ) < 10 then e = "0" & e

f = second( DateM )

Open in new window

0
Experts,
               Greetings!

This question is for SQL SERVER 2012 used in windows server 2012 in a classic asp application.  This is in a functionality where we build the whole HTML required in a page in the stored procedure and write it in a classic asp page using response.write. Data in one column in a row exceeds 50k characters at least.  It was working fine until we used SQL SERVER as the driver and declared as varchar(max). But now that we want to use TLS 1.2, we have had to use SQL SERVER NATIVE CLIENT 11.0. Now it allows only 8000 when SQL SERVER NATIVE CLIENT 11.0 is used. We should be able to use a size of char(100000) for our application requirements. Please assist us with your expertise.


Thanks,
Isaac
0
Hello Experts,
                         We are attempting to disable TLS 1.0 and 1.1 in our servers. When we did that, our classic asp application did not work and we found that it is using SQL SERVER driver with SQLSRV32.DLL. It threw SSL Security error.
 
This is the actual connection string we use for Classic asp:
DRIVER={SQL Server};SERVER=XXXXXXXX;DATABASE=XXXXXXX;uid=XXXXXX; pwd=XXXXXXX
 
We changed the driver to the SQL SERVER NATIVE CLIENT 11.0. and it solved the problem. Everything else worked except for one page, the monthly calendar page. In the page, we generate the whole HTML for the page data in the database base table and append it directly on the .asp page using response.write.  The page does not throw any error, it simply does not load the data that we get from Database using a Stored Procedure.
 
When this did not work we used AJAX to get the html data. Even this did not work.
 
We tried saving HTML data in a variable which also did not happen.
 

We tried adding Response.ContentType = "text/html"
https://msdn.microsoft.com/en-us/library/ms524327(v=vs.90).aspx
 
we installed Microsoft® OLE DB Driver 18 for SQL Server with SQL Server Native Client 11 mentioned as Provider in the connection string. we got other errors.
 
 Is there any restriction with TLS older versions when we get the HTML directly and append it in a page?
 
 
0
I saw this example but this is using JavaScript

ASP TextBox JavaScript OnKeyup Event
https://forums.asp.net/t/1656156.aspx?onkeyup+in+asp+textbox

I want to use C# or VB

On a ASP.NET Web Forms page.

I have a TextBox that looks like this:

<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>


When I click in the textbox with my mouse how do I save the text "you clicked in the textbox" to a ASP Hidden Field using C# or VB?
1
I'm using ASP.NET Web Forms and VB

On my page I have a ASP TextBox and a ASP Button

I'm using the TextChanged event for the textbox.

This is my working code for my page

ASP_TextBox_TextChanged4.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ASP_TextBox_TextChanged4.aspx.vb" Inherits="ASP_TextBox_TextChanged4" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td></td>
                <td><asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged" Text="This is a test"> </asp:TextBox></td>
            </tr>
            <tr>
                <td></td>
                <td><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td></td>
                <td><asp:Button ID="Button1" runat="server" Text="Button" /></td>
            </tr>
        </table>
    </div>
        <asp:HiddenField ID="HiddenField1" runat="server" />
    </form>
</body>
</html>

Open in new window


ASP_TextBox_TextChanged4.aspx.vb

Partial Class ASP_TextBox_TextChanged4
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    'TextBox.TextChanged Event
    ' Occurs when the content of the text box changes between posts to the server.
    

Open in new window

0
add function to classic asp page with vb script.
Is it possible to save a file temporarily and then attach it to an email in vbscript ?

If I split the code below into two distinct pages, both functions work. I can create the Vcard file and it opens to the user.  Or I can create the email.
But I want to add the vcard file to the email.  Is this possible ?
<% 
if (cStr(Request("SubmitHere")) <> "") Then

	Dim DTSTART, DTEND, SUMMARY, LOCATION, EVENT_DESCRIPTION, PRIORITY, UID, CalendarEvent
	
	DTSTART = DateAdd("h",+5, (rsSaleCallDataNewID.Fields.Item("FollowupDate").Value))
	DTEND = DateAdd("h",+5, (rsSaleCallDataNewID.Fields.Item("FollowupDate").Value))
		
	DTSTART = 	Right("0000" & Year(DTSTART), 4) & _
				Right("00" & Month(DTSTART), 2) & _
				Right("00" & Day(DTSTART), 2) & _
				"T13000" & _
				"Z"
	
	DTEND = 	Right("0000" & Year(DTEND), 4) & _
				Right("00" & Month(DTEND), 2) & _
				Right("00" & Day(DTEND), 2) & _
				"T130000" & _
				"Z"
 
	SUMMARY = (rsSaleCallDataNewID.Fields.Item("VisitType").Value)
	LOCATION = (rsSaleCallDataNewID.Fields.Item("Company").Value)
	EVENT_DESCRIPTION = (rsSaleCallDataNewID.Fields.Item("Comments").Value)
	PRIORITY = "0"
	UID = (rsSaleCallDataNewID.Fields.Item("ID").Value)
	
	CalendarEvent = "BEGIN:VCALENDAR" & vbCrlf & _
	"VERSION:1.0" & vbCrlf & _
	"BEGIN:VEVENT" & vbCrlf & _
	"DTSTART:" & DTSTART  & vbCrlf & _
	"DTEND:" & DTEND  & vbCrlf & _
	"SUMMARY;ENCODING=QUOTED-PRINTABLE:" & SUMMARY & vbCrlf & _
	

Open in new window

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.