Link to home
Create AccountLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

Using Classic ASP, how could I display the value of a field in a messagebox to the screen?

I am trying to debug an application written in Classic ASP.

In the following ASP file shown in the code section, do you know how I could display the value of        request("type")
to the screen as a messagebox?
I put asterisks where the statement appears in the code that follows. It appears at the bottom of the code section.
I want to replace the code that states:
else
      Response.Redirect "default.asp"

With a message box stating the value of
request("type")




<%on error resume next
dim conn
dim rst
%>
<!--#include file="dbstringFSNet.asp"-->

<HTML>
<HEAD>
<TITLE>SOX </TITLE>
<link rel="stylesheet" href="onelook.new.css">
</HEAD>

<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bgBlueDark">
	<tr> 
  		<td width="30%" align=left> <img height="42" src="images/hdr_morganstanley_logo.gif" width="152"></td>
		<td width="70%" align="center"><font color=white></font></td>
		<td>&nbsp;</td>
	</tr>
	<tr> 
		<td width="730" colspan="2"><img src="images/transpix.gif" width="1" height="1" vspace="1"></td>
		<td><img src="images/transpix.gif" width="1" height="1" vspace="1"></td>
	</tr>
	<tr> 
		<td class="bgBlueDark" width="730" colspan="2"> 
		</td>
		<td class="bgBlueDark"> 
		</td>
	</tr>
	</table>

<INPUT type="hidden" ID="Text3" NAME="reqid" value="<%=request("reqid")%>">
<INPUT type="hidden" ID="Text4" NAME="type" value="<%=request("type")%>">

<%


%>
<br><br><br><br><br>
<p align=center>
<%
dim id, usrid, pswd
usrid=Request.Form("userid")
pswd=Request.Form("userpassword")
if usrid="" or pswd="" then
	Response.Redirect "default.asp?msg=1"
	Response.End
end if
	
'function authenticate(usrid, pswd) 
'Create the COMDirectory object:
'On Error Resume Next
Dim SearchObject, PersonObject, PersonObject2, PersonDN, check
Set SearchObject = server.CreateObject("MSDotNet.COMDirectory.Search")
'//InitIISEnvironment is preferred over InitVBEnvironment
'//InitIISEnvironment requires/uses AFS (\\ms\dist\) '//InitVBEnvironment uses P:
SearchObject.InitIISEnvironment

'//Replace the following credentials with new ones for
'//Commodities Tempest IT
SearchObject.ConnectFWD2 "cn=finsysldap, ou=ldapids, o=My", "Lk"
'check if user id is correct
Set PersonObject = SearchObject.GetPersonByLogon(usrid)
PersonDN = SearchObject.GetPersonDN(PersonObject)
'On Error GoTo end1
'Response.Write err.number & "****"
if persondn="" then
	Response.Redirect "default.asp?msg=2"
	Response.End
else
	SearchObject.ConnectFWD2 PersonDN, pswd
	'Response.Write persondn &"$$$$$$$$$$$" & PersonObject.LogonID & "222222" 
	
	Set PersonObject2 = SearchObject.GetPersonByDn(PersonDN)
	'authenticate=persondn
	'authenticate=PersonObject2.LogonID
	'Response.Write persondn & "11111111" & PersonObject2.LogonID & "222222"
	'Response.End
	id=PersonObject2.LogonID
	if id ="" then
		Response.Redirect "default.asp?msg=3"
		Response.End
	end if
	'//This will either haved raised an error, or succeeded
	Response.Write err.number & " _ " & err.description 
	'End function
end if


%>
<%
'ldap authentication....

'if authenticated then:
session("id")=id
'Response.Write id & "&********<BR>"
'Response.Write PersonObject2.LogonID & "&********<BR>"
'Response.Write PersonObject2.emailaddress & "&********<BR>"
'Response.Write PersonObject2.givenname & "&********<BR>"
'Response.Write PersonObject2.surname & "&********<BR>"
'Response.Write PersonObject2.manager & "&********<BR>"
'Response.end

if id<>"" then
	eml=PersonObject2.emailaddress
	lname=PersonObject2.surname
	fname=PersonObject2.givenname
	session("eml")=eml
	session("lname")=lname
	session("fname")=fname


set rst= server.createobject("adodb.recordset")  
	ssql="select * from temployees where ldapid='" & id & "'"
	rst.Open ssql, conn, 2,2

	if request("type")="usr" then
		response.Redirect "usrReqDetails.asp?reqid=" & request("reqid") 					
	elseif request("type")="dev" then
		response.Redirect "devReqDetails.asp?reqid=" & request("reqid") 								
	end if
	
	if rst.EOF then		
		response.Redirect "usrdefault.asp"
	else 
		response.Redirect "default.asp"
	end if

else
	Response.Redirect "default.asp"
end if
%>
</body>
</HTML>

Open in new window

Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Then in that case, instead of this:

response.Redirect "default.asp"

use this:
stype =       request("type")

response.Write  stype
Avatar of Wayne Barron
I think that he is referring to a Message Dialog Box.
I think?
Well, in that case, something like this will suffice:

Response.Write("<script language=VBScript>MsgBox """ + stype+ """</script>") 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer