I've been experiencing some (reproducable) wierdness when I try to generate
some very basic HTML using ASP. Check out the following (basic) ASP code:
===========================================
<% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp"
Const STRING_A = "AXFFile" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>"
<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>
<%=STRING_A%>.ObjectName = "<%=STRING_1%>"
</body>
</html>
===========================================
The problem is that, when I "run" the ASP page and view the HTML source code
that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
AXFFile.Server = "www.nbsc.com"
AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp"
</body>
</html>
===========================================
Why do lines 12 (<%=STRING_A%>.Port =
<%=Request.ServerVariables("SERVER_PORT")%>) and 13
(<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in
HTML? Can anybody else reproduce this problem, and if so, do you have any
idea why this is happening? I can always work around it by adding "vbcrlf"
to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =- 13 1585
If you want a carriage return, use <BR>.
I couldn't reproduce your issue (it all appears on one line), but please
don't confuse plain text characters with HTML characters...
-- http://www.aspfaq.com/
(Reverse address to reply.)
"Tek Boy" <ve****************@hotmail.com> wrote in message
news:#8**************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to
generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> =========================================== The problem is that, when I "run" the ASP page and view the HTML source
code that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> AXFFile.Server = "www.nbsc.com" AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp" </body> </html> =========================================== Why do lines 12 (<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>) and 13 (<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in HTML? Can anybody else reproduce this problem, and if so, do you have any idea why this is happening? I can always work around it by adding
"vbcrlf" to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =-
Reproduced! W2K SP3 server. Same behavior on a WS2003.
I can't explain it. That is a bit bizarre! If I throw in some other
characters at the end of the line, all the line breaks appear in the HTML.
<% Option Explicit %>
<%
Const STRING_1 = "/admin/UploadProgress2.asp"
Const STRING_A = "AXFFile"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>"
<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>
<!-- -->
<%=STRING_A%>.ObjectName = "<%=STRING_1%>"
</body>
</html>
The line breaks show up with that. But if I remove the <!-- -->, they do
not.
Ray at work
"Tek Boy" <ve****************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> =========================================== The problem is that, when I "run" the ASP page and view the HTML source code that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> AXFFile.Server = "www.nbsc.com" AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp" </body> </html> =========================================== Why do lines 12 (<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>) and 13 (<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in HTML? Can anybody else reproduce this problem, and if so, do you have any idea why this is happening? I can always work around it by adding "vbcrlf" to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =-
What he was talking about is how the actual HTML source appears. The HTML
file has:
<%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>"
<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>
<%=STRING_A%>.ObjectName = "<%=STRING_1%>"
which should appear as
AXFFile.Server = "oldharleyweb"
AXFFile.Port = 80
AXFFile.ObjectName = "/admin/UploadProgress2.asp"
when doing a view source. But instead, it appears as:
AXFFile.Server = "oldharleyweb"
AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp"
Ray at work
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:O7**************@TK2MSFTNGP14.phx.gbl... If you want a carriage return, use <BR>.
I couldn't reproduce your issue (it all appears on one line), but please don't confuse plain text characters with HTML characters...
-- http://www.aspfaq.com/ (Reverse address to reply.)
"Tek Boy" <ve****************@hotmail.com> wrote in message news:#8**************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=S
Tek Boy wrote: <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>"
I have seen similar behavior, wherein the space below is "dropped" from the
output:
<%=var1%> <%=var2%>
I get around it with non-breaking spaces...
<%=var1%> <%=var2%>
....or concatenation...
<%=var1 & " " &var2%>
....and assume the reason has to do with optimization by the parser. Note
that in your example, there is a necessary (because of the quote) context
switch between lines 1&2, but the server-side blocks at the end of 2 and the
beginning of 3 could be considered a single block, which appears to be the
way it is processed.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
> The problem is that, when I "run" the ASP page and view the HTML source code that is generated, I get the following:
doesn't do that for me. It appears as it should. Maybe in your copy
there's really not a CRLF in there. Just delete the LF between the
2nd and 3rd statement, and hit enter to put it back.
What does it matter what the HTML looks like?
You need to ad a vbCRLF to the end of the line to force a CRLF at the end of
the line in the raw HTML.
Like this:
<%=STRING_A%>.Server = <%=Request.ServerVariables("SERVER_NAME") & vbCRLF %>
<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT") & vbCRLF %>
<%=STRING_A%>.ObjectName = <%=STRING_1 & vbCRLF%>
Without the shortcut form of "response.write" it would look like this:
<%
Response.write STRING_A & ".Server = " &
Request.ServerVariables("SERVER_NAME") & vbCRLF
Response.write STRING_A & ".Port = " &
Request.ServerVariables("SERVER_PORT") & vbCRLF
Response.write STRING_A & ".ObjectName = " & STRING_1 & vbCRLF
%>
If you want the redered HTML to break the same way then add the right "<br>"
at the end.
<%=STRING_A%>.Server = <%=Request.ServerVariables("SERVER_NAME") & "<br>" &
vbCRLF %>
<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT") & "<br>" &
vbCRLF %>
<%=STRING_A%>.ObjectName = <%=STRING_1 & vbCRLF%> <br>
Without the shortcut form of "response.write" it would look like this:
<%
Response.write STRING_A & ".Server = " &
Request.ServerVariables("SERVER_NAME") & "<br>" & vbCRLF
Response.write STRING_A & ".Port = " &
Request.ServerVariables("SERVER_PORT") & "<br>" & vbCRLF
Response.write STRING_A & ".ObjectName = " & STRING_1 & "<br>" & vbCRLF
%>
--
Phillip Windell [MCP, MVP, CCNA] www.wandtv.com
"Tek Boy" <ve****************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to
generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> =========================================== The problem is that, when I "run" the ASP page and view the HTML source
code that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> AXFFile.Server = "www.nbsc.com" AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp" </body> </html> =========================================== Why do lines 12 (<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>) and 13 (<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in HTML? Can anybody else reproduce this problem, and if so, do you have any idea why this is happening? I can always work around it by adding
"vbcrlf" to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =-
la**********@yahoo.com (Larry Bud) wrote in message news:<5d**************************@posting.google. com>... The problem is that, when I "run" the ASP page and view the HTML source code that is generated, I get the following:
doesn't do that for me. It appears as it should. Maybe in your copy there's really not a CRLF in there. Just delete the LF between the 2nd and 3rd statement, and hit enter to put it back.
What does it matter what the HTML looks like?
It matters because it's trying to assign property values to a
client-side ActiveX component (Software Artisans' XFile). If the two
lines are not rendered as separate lines of code, the ActiveX
component sees it as an invalid assignment statement, and causes the
entire page to fail (where my needs are concerned). Part of the
reason I abhor client-side validation and error-trapping.........
Thank you _SO_ much for testing it out, Ray. I can't tell you how
frustrated I when I found out what was happening, even though my
code's syntax was correct. I'm on hold with Microsoft right now, so
we'll see what they have to say about all this, and if there's any
hope for fixing it.
-= Tek Boy=-
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in message news:<#D*************@TK2MSFTNGP15.phx.gbl>... Reproduced! W2K SP3 server. Same behavior on a WS2003.
I can't explain it. That is a bit bizarre! If I throw in some other characters at the end of the line, all the line breaks appear in the HTML.
<% Option Explicit %> <% Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <!-- -->
<%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html>
The line breaks show up with that. But if I remove the <!-- -->, they do not.
Ray at work
"Tek Boy" <ve****************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> =========================================== The problem is that, when I "run" the ASP page and view the HTML source code that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> AXFFile.Server = "www.nbsc.com" AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp" </body> </html> =========================================== Why do lines 12 (<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>) and 13 (<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in HTML? Can anybody else reproduce this problem, and if so, do you have any idea why this is happening? I can always work around it by adding "vbcrlf" to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =-
I know about the spacing behavior you described, and I always
explicitly declare a space (using , or Response.Write) when
trying to separate two server-generated blocks of text. That
"problem" seems to be consistent, though, and is probably by design.
It's not as easy to work around the problem when dealing with
vBcRlf's, though. Sometimes the line-break is rendered, sometimes it
isn't; and according to people in this thread, it occurs on some boxes
and not others. Besides, I really don't want to have to attach
"vBcRlf" to the end of every line of code, just to make sure it's
rendered properly.....
-= Tek Boy =-
"Dave Anderson" <GT**********@spammotel.com> wrote in message news:<uM**************@tk2msftngp13.phx.gbl>... Tek Boy wrote: <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>"
I have seen similar behavior, wherein the space below is "dropped" from the output: <%=var1%> <%=var2%>
I get around it with non-breaking spaces... <%=var1%> <%=var2%>
...or concatenation... <%=var1 & " " &var2%>
...and assume the reason has to do with optimization by the parser. Note that in your example, there is a necessary (because of the quote) context switch between lines 1&2, but the server-side blocks at the end of 2 and the beginning of 3 could be considered a single block, which appears to be the way it is processed.
"Saiyan Vejita" <ve*******@hotmail.com> wrote in message
news:5e**************************@posting.google.c om... I'm on hold with Microsoft right now, so we'll see what they have to say about all this, and if there's any hope for fixing it.
Nice! Please post back if they say anything interesting.
Thanks,
Ray at work
Try re-adding the CRLF, and type in some spaces after
<%=Request.ServerVariables("SERVER_PORT")%>.
Or force the CRLFs yourself with
<%
Response.Write STRING_A & ".Server = """ &
Request.ServerVariables("SERVER_NAME") & """" & char(13) & chr(10)
Response.Write STRING_A & ".Port= " & Request.ServerVariables("SERVER_PORT")
& char(13) & chr(10)
Response.Write STRING_A & ".ObjectName = " &
Request.ServerVariables("STRING_1") & char(13) & chr(10)
%>
& avoid the situation entirely.
--
Ben Strackany www.developmentnow.com
"Tek Boy" <ve****************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... I've been experiencing some (reproducable) wierdness when I try to
generate some very basic HTML using ASP. Check out the following (basic) ASP code:
=========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> =========================================== The problem is that, when I "run" the ASP page and view the HTML source
code that is generated, I get the following:
===========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> AXFFile.Server = "www.nbsc.com" AXFFile.Port = 80AXFFile.ObjectName = "/admin/UploadProgress2.asp" </body> </html> =========================================== Why do lines 12 (<%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%>) and 13 (<%=STRING_A%>.ObjectName = "<%=STRING_1%>") appear as a single line in HTML? Can anybody else reproduce this problem, and if so, do you have any idea why this is happening? I can always work around it by adding
"vbcrlf" to the end of each line, but I'd rather not work around it...........
Any help would be greatly appreciated..... thanks in advance!
-= Tek Boy =-
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in message news:<#g**************@TK2MSFTNGP15.phx.gbl>... "Saiyan Vejita" <ve*******@hotmail.com> wrote in message news:5e**************************@posting.google.c om... I'm on hold with Microsoft right now, so we'll see what they have to say about all this, and if there's any hope for fixing it.
Nice! Please post back if they say anything interesting.
Thanks,
Ray at work
So, after a few days of the Microsoft customer service rep looking
into the problem, I'm told what I already know: that, if there's no
visible character appearing on the same line after the closing ASP tag
("%>"), all subsequent whitespace between the "%>" and the next
visible character will be disregarded. The only two solutions are: 1)
to make sure a visible character appears after the "%>" closing tag on
a given line (in my case, a hard-coded <%=vbcrlf%>), or 2) use
"Response.Write" statements to write out the text.
So, for my needs, I'll probably just stick with my original
workaround:
==========================================
<% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp"
Const STRING_A = "AXFFile" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%=STRING_A%>.Server =
"<%=Request.ServerVariables("SERVER_NAME")%>"
<%=STRING_A%>.Port =
<%=Request.ServerVariables("SERVER_PORT")%><%=vbcr lf%>
<%=STRING_A%>.ObjectName = "<%=STRING_1%>"
</body>
</html>
==========================================
-= Tek Boy =-
Very cool. Thank you for the update.
Ray at home
"Saiyan Vejita" <ve*******@hotmail.com> wrote in message
news:5e**************************@posting.google.c om... So, after a few days of the Microsoft customer service rep looking into the problem, I'm told what I already know: that, if there's no visible character appearing on the same line after the closing ASP tag ("%>"), all subsequent whitespace between the "%>" and the next visible character will be disregarded. The only two solutions are: 1) to make sure a visible character appears after the "%>" closing tag on a given line (in my case, a hard-coded <%=vbcrlf%>), or 2) use "Response.Write" statements to write out the text.
So, for my needs, I'll probably just stick with my original workaround:
========================================== <% Option Explicit
Const STRING_1 = "/admin/UploadProgress2.asp" Const STRING_A = "AXFFile" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%=STRING_A%>.Server = "<%=Request.ServerVariables("SERVER_NAME")%>" <%=STRING_A%>.Port = <%=Request.ServerVariables("SERVER_PORT")%><%=vbcr lf%> <%=STRING_A%>.ObjectName = "<%=STRING_1%>" </body> </html> ========================================== -= Tek Boy =- This discussion thread is closed Replies have been disabled for this discussion. Similar topics
6 posts
views
Thread by David Opstad |
last post: by
|
reply
views
Thread by Matthew Alton |
last post: by
|
reply
views
Thread by amber |
last post: by
|
5 posts
views
Thread by Eduardo Olivarez |
last post: by
|
3 posts
views
Thread by David Whitney |
last post: by
|
4 posts
views
Thread by tobfon |
last post: by
|
reply
views
Thread by Juan R. |
last post: by
|
5 posts
views
Thread by paul.hester |
last post: by
|
9 posts
views
Thread by Bobby Edward |
last post: by
| | | | | | | | | | |