Wells-it.com - Web Hosting

ASP and JavaScript -

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 4,727 posts

Joined: Jan 1970

Can anyone help me out with an ASP /JavaScript question?

I need to code a page so a call to a URL is not hard-coded with a machine name or ISP, but the script HTTP_HOST is substituted instead (so the code in this one file can work on multiple machines). The solution we've come up with here is this line of code

<%=Request.ServerVariables("HTTP_Host")%> replacing the machine name/IP address ie instead of

Link="https://www.site.com

we've substituted
Link="https://<%=Request.ServerVariables("HTTP_Host")%>

The problem seems to be that the <% %> tags around request.serverVariables are interfering with <% %> tags around a larger if/then statement.

This may be too vague to help? My site is internal, so I can't provide a link unfortunately.

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

I haven't ever used ASP myself, so I can't be of much help- but I'm sure someone here has some experience and will be able to help out.

------------------
John Pollock
www.pageresource.com
www.javascriptcity.com

They have: 2,397 posts

Joined: Nov 1998

I know that Chad works with ASP, you can find him in the Hosting Forums.
JP

------------------
The Webmaster Promotion and Resource Site
www.what-next.com
The NEXT step in Designing and Promoting your Website

JP Stones
Perforated Edge - Tearing Through Convention

A UK Based Creative Communications Agency

Mark Hensler's picture

He has: 4,044 posts

Joined: Aug 2000

found this while searching for something else.
Easy solution...

original code:

<%
if this = that then
'blah

Link="https://<%=Request.ServerVariables("HTTP_Host")%>

'blah
end if
%>

'
corrected code

<%
if this = that then
'blah

Link="https://" & Request.ServerVariables("HTTP_Host")

'blah
end if
%>

'

Mark Hensler ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.