Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 29th, 2004, 10:16 AM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server Variables

I'm getting an error message that i have an "unterminated string constant" in my routing to retrieve servervariables from the Request object. I'm including the code as it is very brief. I'm doing this on my lattop running in XP professional with IIS installed. I am assuming that as a server also it includes the servervariable collection. Otherwise I can't see a thing that's incomplete or incorrect about it...here it is. Thanks in advance!
================================================== ====

<%
    Option Explicit
    Dim Key
%>

    <HTML>
    <HEAD>
    <TITLE>The HTTP Server Variables Collection</TITLE>
    </HEAD>

    <BODY BGCOLOR=white>
    <CENTER>
    <H2>The HTTP Server Variables Collection</H2>
    </CENTER>

    <TABLE BORDER=1>
    <TR>
        <TD><B>Variable Name</B></TD>
        <TD><B>Value</B></TD>
    </TR>
<%
    For Each Key in Request.ServerVariables
        Response.Write "<TR><TD>" & Key & "</TD><TD>"

    If Request.ServerVariables(key) = " " Then
        Response.Write "&nbsp;"
    Else
        Response.Write Request.ServerVariables(key)
    End If

    Response.Write "</TD></TR>"
    Next
%>

 
Old February 29th, 2004, 10:35 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Is this supposed to be an ASP or an ASP.NET page? If the former, you may want to use the ASP forums instead. This one is for ASP.NET.
If it is supposed to run as an ASP.NET page, you may need to change a few pieces here and there. Firstly, using Response.Write directly in the page is not really recommended. Secondly, the Response.Write statements need () around the param values.

In either case, there is not much wrong with this page. Are you sure this is all the code? Isn't there an include file causing the problem?

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 29th, 2004, 10:39 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your code works fine for me unaltered. The only things I can thinks of are
* do you have VBScript set as the default scripting language? If you have JScript set then you need to add the @language setting at the top of the page
* how are you calling the page? Obviously the web service must be running and, assuming the page is called test.asp and is installed in c:\inetpub\wwwroot (the default set up for IIS), the url will be http://localhost/test.asp



--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing server variables badgolfer Classic ASP Professional 2 October 23rd, 2007 03:11 AM
SQL Server XML - Passing Variables dkb XML 0 April 4th, 2005 03:43 AM
Again about the Server Variables s_ranjith Classic ASP Basics 0 October 1st, 2004 06:02 AM
Reg. Server Variables s_ranjith Classic ASP Basics 1 September 30th, 2004 09:31 AM
Login request when I user server variables Blaise Classic ASP Basics 0 September 7th, 2003 08:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.