Skip to content

Instantly share code, notes, and snippets.

View evagoras's full-sized avatar

Evagoras Charalambous evagoras

View GitHub Profile
@evagoras
evagoras / download.asp
Created September 28, 2023 14:03
Downloading any file using ASP, FSO and the ADODB Stream object
<%@Language="VBScript"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
On Error Resume Next
Dim strPath
strPath = CStr(Request.QueryString("file"))
'-- do some basic error checking for the QueryString
If strPath = "" Then
Response.Clear
@evagoras
evagoras / call-download
Created September 28, 2023 14:01
Downloading any file to the browser – Part II: using ASP.NET
<a href="download.aspx?file=/images/logo.gif">Download the logo image</a>
@evagoras
evagoras / create-variables
Created September 28, 2023 13:55
Generating an XML file of your website’s folders/files
<%@Language="VBScript"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
'-- set a 600 second timeout value in case it hangs
Server.ScriptTimeOut = 600
On Error Resume Next
Dim strRootFolder
Dim intLenRootFolder
@evagoras
evagoras / asproutines.asp-displaynode
Created September 28, 2023 13:47
Dynamic Tree Menu of your site
Sub DisplayNode(ByVal objNodes, ByRef iElement, ByRef sLeftIndent, ByRef sOpenFolders)
...
'Ignore NODE_TEXT node types
If oNode.nodeType = NODE_ELEMENT Then
sNodeType = oNode.nodeName
sAttrValue = oNode.getAttribute("name")
sURL = Server.URLEncode(oNode.getAttribute("path"))
...
'Now display the document node
%>
@evagoras
evagoras / 404.aspx-header
Created September 28, 2023 13:41
A custom ‘404 Page Not Found’ in ASP.NET
<%@ Page Language="VB" runat="server" explicit="true" strict="true" %>
<%@ Register TagPrefix="UserControl" TagName="Header" Src="head.ascx" %>
<%@ Register TagPrefix="UserControl" TagName="Footer" Src="tail.ascx" %>
<%@ Import Namespace="System.Web.Mail" %>
...
@evagoras
evagoras / asp-folder-size
Created September 28, 2023 13:31
Calculating the Size of a folder in ASP.NET
<%@Language="VBScript"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
Dim objFso
Dim objFolder
Dim lngSize 'size of the folder and its contents
Dim folderPath 'virtual or physical path of the folder
Set objFso = Server.CreateObject("Scripting.FileSystemObject")
objFolder = objFso.GetFolder(folderPath)
@evagoras
evagoras / check-all
Last active September 28, 2023 13:28
Creating clickable table rows in ASP.NET that change colors
...
//color all rows when the main checkbox is clicked
function checkAll(form) {
var thisNumRowsSelected = 0;
var isChecked = document.all.cbxSelectAll.checked;
for (var i=0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf('_ctl') > -1) {
var curElement = form.elements[i];
if (isChecked) {
curElement.checked = true;
@evagoras
evagoras / machine.config
Last active September 28, 2023 10:26
Configuring the ASP.NET Worker Process through the ‘machine.config’ file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutDownTimeout="00:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
@evagoras
evagoras / aspx
Last active September 28, 2023 10:06
Creating and consuming a Web Service using Visual Studio .NET
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb" Inherits="DegreesWebService._default"%>
<!DOCTYPE HTML PUBLIC "<em>-//W3C//DTD HTML 4.0 Transitional//EN"</em><em>></em>
<HTML>
<HEAD>
<title>default</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
@evagoras
evagoras / aspx
Created September 28, 2023 09:59
Copying a directory in ASP.NET
<!DOCTYPE HTML PUBLIC "<em>-//W3C//DTD HTML 4.0 Transitional//EN"</em><em>></em>
<html>
<head>
<style TYPE="text/css">
body {
font-family: Verdana;
font-size: 70%;
}
table tr td {
font-family: Verdana;