If it has a plug, it's IT stuff

Sep 25 2008   3:16PM GMT

[TLBAT] Intranet: request_package.asp

alessandro.panzetta Alessandro Panzetta Profile: alessandro.panzetta

In the previous post we have seen the code that stays behind the scenes and that checks if a user is allowed to download the file. But what happens if the user is not allowed to download the requested software?

If you check the ASP code in my previous post you will see that there is a subroutine called RequestPack that accepts two parameters: NEEDED_GROUP and FILE. So whenever a user is not allowed there is an IF/THEN clause that, in case of not allowance to download a file, redirects the user to the RequestPack subroutine.

if Licensed = True then

Call GimmePack(FILE)


    Call RequestPack(NEEDED_GROUP, FILE)

End if

What the RequestPack will do is to redirect the user to a page called request_package.asp where he/she will be asked if they want to request access to this package, if yes an email will be sent to the Download Center administrator with all necessary information.

Here is the RequestPack routine, present in the download_special.asp page, that builds the link to the request_package.asp page:


    Response.Redirect “request_package.asp?UserName=” & UCase(USERID) & “?Group=” & NEEDED_GROUP & “?File=” & FILE & ” ”

End Sub

Hereafter the code for the request_package.asp page, in the next post we will start seeing the Administration part of the Download Center where we can add/remove packages, define site’ subnets, configure the replication between distribution points and so on so….stay tuned!!!



USERID = Request.querystring(“UserName”)

NEEDED_GROUP = Request.querystring(“Group”)

FILE = Request.querystring(“File”)

File1 = Split(FILE,”.”)


<center><hr width=50% color=006699><font face=”Tahoma” color=”#006699″> <% response.write UCase(USERID) %> requests <% response.write UCase(File1(0)) %></center><hr width=50% color=006699>

<!–webbot BOT=”GeneratedScript” PREVIEW=” ” startspan –><script Language=”JavaScript” Type=”text/javascript”><!–

function FrontPage_Form1_Validator(theForm)


if (theForm.Confirmation.value == “”)


alert(“Please enter a value for the \”Confirmation\” field.”);


return (false);


if (theForm.Confirmation.value.length < 2)


alert(“Please enter at least 2 characters in the \”Confirmation\” field.”);


return (false);


if (theForm.Confirmation.value.length > 3)


alert(“Please enter at most 3 characters in the \”Confirmation\” field.”);


return (false);


var checkOK = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ”;

var checkStr = theForm.Confirmation.value;

var allValid = true;

var validGroups = true;

for (i = 0; i < checkStr.length; i++)


ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)

if (ch == checkOK.charAt(j))


if (j == checkOK.length)


allValid = false;




if (!allValid)


alert(“Please enter only letter characters in the \”Confirmation\” field.”);


return (false);


return (true);


//–></script><!–webbot BOT=”GeneratedScript” endspan –><form method=”GET” action=”request_package.asp” onsubmit=”return FrontPage_Form1_Validator(this)” language=”JavaScript” name=”FrontPage_Form1″>

<p align=”center”><font face=”Tahoma” color=”#006699″>You are going to request the license for the software package <b><% response.write File1(0) %></b> do you confirm the request?</font></p>

<p align=”center”>

<!–webbot bot=”Validation” s-display-name=”Confirmation” s-data-type=”String” b-allow-letters=”TRUE” b-value-required=”TRUE” i-minimum-length=”2″ i-maximum-length=”3″ –><input type=”text” name=”Confirmation” size=”20″ value=”Please type YES or NO” maxlength=”3″></p>

<p align=”center”><input type=”submit” value=”Submit” name=”B1″></p>




if Request.querystring(“Confirmation”) = “Please type YES or NO” then

elseif Request.querystring(“Confirmation”) = “YES” then

    Set objEmail = CreateObject(“CDO.Message”)

    objEmail.From = download_center@mydomain.com ‘BE SURE TO CHANGE THIS

    objEmail.To = “dloadcenter_admin@mydomain.com”‘BE SURE TO CHANGE THIS

    objEmail.Subject = “[Download Center 2.0] Package request from: ” & UCase(USERID)

    BodyTxt = “The user ” & UCase(USERID) & ” must be added to ” & NEEDED_GROUP & ” group in order to be allowed to download <b>” & FILE & “</b>” & vcbcrlf

    objEmail.Textbody = BodyTxt & “Please verify with the user’s manager to see if the user is allowed to download this software.”

    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2

    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “mail.lamrc.com”

    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25





End If

%><head><title>..:: Download Center ::..</title></head>

======END CODE======

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: