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.

Thanks to help from this site I am ready to add "Remember Me" functionality to http://www.gtraxc.com/login.asp.  I believe I know how to set and retrieve cookies.  I also know not to use cookies to populate user name and password fields.  I just need some assistance putting this together on a classic asp page.  Here are my assumptions and questions.  Please correct as necessary, and thank you in advance!

1) I assume that I collect the cookies if "Remember Me" is selected from the form submission using the following process:
            If Request.Form.Item("remember-me") = "on" Then
                Response.Cookies("user_name") = sUserName
                Response.Cookies("password") = sPassword
                Response.Cookies("password").Expires=#March 1, 2020#
            End If

Open in new window


2) I assume I could have the expiry be Date + 180 since it seems like its a good practice to keep them for 6 months?

3) I know that when I check for cookies, if I find that they exist and have not expired I use that to log the user in and redirect them to the necessary page.  I assume that I do that at the very beginning of the asp code using code something like:
        sUserName = Request.Cookies("user_name")
       sPassword = Request.Cookies("password")
      'check for existence in the db and if found redirect to the appropriate page

Open in new window

0
What is the best way to convert milliseconds from 1/1/1970 to current date/time in classic asp?

Here is what I want to convert: 1572891578547 (I really only need hours:minutes:seconds)

Thank you!!!!
0
I am trying to get the exact time a classic asp form submit is clicked.  I want to get the time on the client side so that, if there is a delay getting to the server, the time is already stored.  Below is what someone on this forum gave me.  I closed the post before I implemented it.  Can someone tell me why it is not submitting the "time" value please?  Thanks so much!
                <hr>
                <form role="form" class="form-inline" name="set_start" method="post" 
                action="set_time.asp?software=<%=sSoftware%>&amp;event_id=<%=lEventID%>&race_id=<%=lRaceID%>">
                <input type="hidden" id="time" name="time">
                <input type="hidden" name="submit_start" id="submit_start" value="submit_start">
                <input type="submit" class="form-control bg-success" name="get_start" id="get_start" value="Set Time Now!"
                style="height:150px;font-weight:bold;font-size:1.5em;">
                </form>
            <%End If%>
        <%End If%>
    <%End If%>
</div>
<script>
    document.getElementsByTagName("form")[0].onsubmit = function() {
          document.getElementById("time").value = new Date().getTime(); // number of millisecond from 01/01/1970
    }
</script>
</body>

Open in new window


Here is the server side code:
    dDateTime = Request.Form.Item("time")

Open in new window


It returns nothing.  Can someone tell me what I can do to resolve this please?
0
Hello Experts.....

I have a file called myinventory.csv in the downloads directory of my website.
I would like to display a hyperlink on a webpage that says download inventory.
When the link is clicked, I would like the user to be able to select a folder on his local machine,
and download the file.

Can anyone give me code to display "Download Inventory" as a hyperlink and to perform this function?  The relative path of the file would be \downloads\myinventory.csv

This is what I have so far:

<a href='\downloads\myinventory.csv'>Download Inventory</a>
1
Need to read page URL or change URL string parameters in the browser without reloading the page, for example on checkbox click event or page load.
Should be able to bookmark the page with all correct parameters.

Thank you in advance.
0
Hi,

I am new to web development and c# and java script in particular.  I have a problem I have been stuck on for a few days.  I have a ASP Core project.  I have a button on a page that calls some javascript code to pass in a serial number and I want it to return some data from my controller.  There are several fields in my model data, but to keep it simple i will just try and show 2.  The problem is it is showing the serial number but any other field it shows the value as undefined when i load the page and press the button.

The java script I have is:
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>

    $(document).ready(function () {
        $("#abc").click(function (e) {
            if ($("#SerialNumber").val() == "")
                alert("SerialNumber cannot be empty");
            else if ($("#Comments").val() == "")
                alert("Comments cannot be empty");
            else {
                $.ajax({
                    type: "POST",
                    url: "/Home/GetSecuredData",
                    data: {"serialNumber": + $("#SerialNumber").val() },
                    success: function (result, status, xhr)
                    {
                        var html1 = ""
                         $.each(result, function (items, OperationsData)
                        {
                
                                html1 += `                                
                                       

Open in new window

0
Hi guys
I use classic ASP
Is there a way to find out  if user's  JavaScript is enabled or disabled and store the answer in a Boolean variable (True or false)
Thanks
Dory
0
Hi I am new to C# core and I come from a VB forms background.  I have been working on a web application project using the latest asp core.  

All i am trying to do at the moment is have a page where you enter a serial number then on leaving that serial number it comes back and displays some additional information from a stored procedure in a grid on the page or it displays an error from the stored procedure.  Then there is another button that will fire another stored procedure that will insert data into a database or return an error on error checks.   If not an error the whole page resets and ready for the next one.

The problem I have been having is that i cannot work out how to fire the stored procedure and return the data after leaving the text box and display an error if needed.  To simply it I have added a button so I enter the serial number then press the button rather than get the on leave event from the text box.

My problem is the data is binded before the page loads with some default data.  I do not know how to do it part of the way through or how to pass a parameter (serial number to it).  I have the ajax to call a function that displays the data from before, but i do not know how to change the lookup to be based on that serial number.  Or in the case of being an error display an error.

My code is below:
Model class:
public class OperationsData
    {

       public string Job { get; set; }
       public string Item { get; set; }
       public 

Open in new window

0
I need to capture the exact time and write it to a sql server db via a classic asp web page.  I have a page that does that now...sort of.  It uses the Now() asp function.  The problem is that, if the internet happens to be slow where we are, by the time the command goes to the server, the time may not be as precise as we need.  Is there a way to capture that time client side (using javascript for instance) and then write it to the server, all with one button submit?

Thanks in advance for your help.
0
Need to get value of webpage URL (with query string parameters, without, and only string with parameters)
Thank you in advance.
0
Hello Experts,

Recently I have had reports that customers can make $0 Value  purchases with the default 1111 promo from https://cart.citysightseeingtoronto.com/

I realize that now if you leave all passengers as 0 you can still continue, I will fix this. However, real purchases with >0 passengers (not just infants) are going through with $0 being charged.

Is anyone able to make such $0 purchases? If so, I would greatly appreciate how to replicate/fix. I would also appreciate if I can get  the confirmation number they get, so that I can void it.

Since this is coming from the general public, I do not have the type of browser used, etc. As you'll also note this is a legacy app in Classic ASP, but if needed, I was hoping if someone can give e a pointer on how to get and store the client (browser) info,  so I can add it to a field for analysis? I'm  drawing a blank, would this be a part of the equivalent of $_SERVER, or js header()?

Any help will be appreciated.
0
I have a classic asp site that currently creates a plain text file from a database.  The end user then has to turn it into a *.csv file.  Is there a way to create the *.csv file directly?

Here is how I create the file:
Set fs=Server.CreateObject("Scripting.FileSystemObject")
sFileName = "C:\inetpub\h51web\gopherstateevents\dwnlds\athl-net_" & sMeetName & "_" & Year(dMeetDate) & ".txt"
Set fname=fs.CreateTextFile(sFileName, True)

fname.WriteLine(sMeetName)
fname.WriteLine(dMeetDate)
fname.WriteLine(sRaceName)
fname.WriteLine(iDist & " " & sUnits)

fname.WriteBlankLines(1)

fname.WriteLine("PLACE" & vbTab & "FIRST" & vbTab & "LAST" & vbTab & "GENDER" & vbTab & "GR" & vbTab & "TEAM" & vbTab & "TIME")
For i = 0 to UBound(RsltsArr, 2)
    fname.WriteLine(i + 1 & vbTab & RsltsArr(0, i) & vbTab & RsltsArr(1, i) & vbTab & RsltsArr(2, i) & vbTab & RsltsArr(3, i) & vbTab & RsltsArr(4, i) & vbTab & RsltsArr(5, i))
Next

fname.Close
Set fname=nothing
Set fs=nothing

Open in new window

0
Hi all, I am not sure how to describe this, but I will try my best.

What I would like to do is show all dates set between 2 dates.

EG - Dates between 8/10/2019 & 21/10/2019 (will vary from each itinerary given to clients)
Show:
8/10/2019
9/10/2019
11/10/2019
12/10/2019
13/10/2019
14/10/2019
15/10/2019
16/10/2019
17/10/2019
18/10/2019
19/10/2019
20/10/2019
21/10/2019

Hopefully this as good as an explanation as needs to be :P

I am coding in ASP Classic and I have tried a few things, just do not work and make a mess, so I need some fresh experienced eyes to put me on the right path
0
Hi Guys
is there a way to block access to a single web page by IP?
 how is this done in iis 7.5 or above?
Solution needs to work in  Classic ASP!
How secure is your solution?
Thanks
Dory
0
hi

i have a user control uc_DocumentDate that contains a textbox ex:txt_Date
and inside the user control  i am doing the below $('#<%=txt_date.ClientID %>').change(function () {}
where inside i am filling hiddenfield hdn_1.value = "test"

Now, i have a web form where i am dragging and dropping the user control inside
and i am doing the below
try {
                var m_uc_DocumentDate = document.getElementById("<%=uc_DocumentDate.FindControl("txt_Date").ClientID%>");
                var m_uc_DocumentDate_ToSql = document.getElementById("<%=uc_DocumentDate.FindControl("hdn_1").ClientID%>");
                $("#" + m_uc_DocumentDate.id).on("change", function () {
                   
                });
            } catch (e) {

            }

Open in new window

         

after debugging the case i found that on change of thh form is fired before on change of thh user control
howcan i make the onchange of the user control  before on change of teh user control inside teh form
0
I have a datetime value that I'd like to specifically format like:

Thursday, May 19, 2019 1:00 PM

The standard FormatDateTime function doesn't fit since it either uses 24-hour format, or includes seconds.

Any suggestions would be appreciated.
0
Hello.  Is there a way to increase the time that a classic asp page is active for longer than the default IIS setting (which I think is 20:00)?  I have a page that I would like to not time out for about 3:00:00 but I really don't want that duration for the entire site.
0
I'm looking for a more attractive calendar to use on my classic asp site.  Here is my "home brew" version.  Looking for something that uses bootstrap 4
0
How can I get just time of day (24 hour format) from the Now() function in classic asp?  For instance, it currently generates 8/31/2019 6:46:11 PM and what I need is 18:46:11

Thanks in advance.
0
I have been trying to get more efficient by using sql.execute rather than opening and closing a recordset.  However there are a few times when I want to know how many records there are.  For intance, in the link below it says there are -1 finishers in that particular race.  How can I get the actual number without using rs.RecordCount (which can only be done by opening the recordset, correct?).  Or is this a case where opening the recordset is the best way to go?

Thanks in advance!

https://www.gopherstateevents.com/results/cc_rslts/cc_rslts.asp?meet_id=600&show_indiv=n&hide_team=n&hide_ind=n&sport=Cross-Country
0
Using Classic ASP, VB Classic, and MS SWL Server:  Apologies in advance because I have posted this before but the solutions haven't "worked".  User error maybe but I need to speed up some queries.  For instance, this should be an execute but it throws an error if there is no data returned (I would like it to return a null value or 0 if no data is returned):
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql = "SELECT MeetClass FROM MeetTeams WHERE MeetsID = " & lThisMeet & " AND TeamsID = " & lTeamID
    rs.Open sql, conn, 1, 2
    lMeetClass = rs(0).Value
    rs.Close
    Set rs = Nothing

Open in new window


I need the same solution when populating an array with GetRows.  Here is an example:  If this recordset returns no rows, then how do I dim the array?  If no records are returned I need it to Dim as MeetArray(3, 0) so it doesn't thow an error on the page when listing out meets that don't exist.  I've been given a solution that involved If rs.BOF = rs.EOF Then... but then it never returns any results.
Dim MeetArray
sql = "SELECT MeetsID, MeetName, MeetDate FROM Meets WHERE MeetDate <= '" & Now() & "' AND ShowOnline = 'y' "
sql = sql & "AND Sport = '" & sSport & "' ORDER BY MeetDate DESC"
Set rs = conn.Execute(sql)
MeetArray = rs.GetRows()
Set rs = Nothing

Open in new window


Big event with lots of participants and folks hitting my website for results in about three weeks.  Any help would be much appreciated.
0
Hi Experts,
I would like to display content on a web page based by the logged in user's computer name.
i.e.
If computer name is 'ABC123' then the web page displays 'XXX Content'
If computer name is 'XYZ123' then the web page displays 'WWW Content'
If computer name is not in the database then the web page displays 'You are not registered'

The computer names are retrieved from a SQL Server database.
Is there any script that can capture the visitor's computer name and display the content accordingly?
I am using classic ASP.

Thank you for your help.
1
Have problem running the integration test on ASP Core 3.0 on my project. Any idea ?

TEST
0
I am trying to set up a VPS but this came with no configuration at all, i am trying to set up the iis at the moment and i am struggling

its on a windows 2019 datacenter server, with IIS 10

the error i am getting is "can not verify access to path " (microsoft say this is just a warning and will be fine at run time)

however it will not process  server side includes as it cant find the folder, unless i put in the full path in the Include tag, this isnt an option as it would mean to much editing of the code for each instance


<!-- #INCLUDE virtual="/cmms/common/db_obj.asp" -->  Doesnt work

<!-- #INCLUDE virtual="harbourside/cmms/common/db_obj.asp" --> does work

server side include is configured in iis , and set to true in the asp module

I have spent days trying to figure this out, i cant find much help on iis 10 in google
0
We need to build a 64 bit ASP MVC app that can use 64 bit powershell. This is proving to be much harder than we thought. We have successfully built our app in a console using 64 bit debug properties, however when we try to build a new MVC 64bit project, we are getting error upon error.

What we are trying to accomplish is having a self service web page where a user can view an action and click a button. That button will execute a powershell script and provide the user confirmation the task was completed. Something like: [copy file to FTP]. The user clicks the button the PoSh gets executed copying the file to the correct location the user is not aware of, then the user gets output on the webpage stating the file copy was a success.

I feel we are missing something simple here. Does anybody out there have experience building something like this and if so can they point me to a comprehensive web article or book that will show us how to get a 64 bit MVC app working with the following assemblies added:

using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Microsoft.FailoverClusters.PowerShell;

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.