Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Asp In Head or Body

Reply
Thread Tools

Asp In Head or Body

 
 
hon123456
Guest
Posts: n/a
 
      04-22-2008
Dear all,

I want to know the difference and effect of placing ASP
Code in the begining of .asp File and placing code inside <Head> </
Head> Tag and Placing code inside <body></body> tag. Just as
follows:

1. Placing code in the Begining of asp file

<% Response.write "Hello" %>

<head>....</head>
<body>....</Body>


2. Placing code in the Head

<head> <% Response.write "Hello" %> </head>
<body>....</Body>


3. Placing code in Body

<head>.....</head>
<body> <% Response.write "Hello" %> </body>



 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      04-22-2008

"hon123456" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear all,
>
> I want to know the difference and effect of placing ASP
> Code in the begining of .asp File and placing code inside <Head> </
> Head> Tag and Placing code inside <body></body> tag. Just as
> follows:
>
> 1. Placing code in the Begining of asp file
>
> <% Response.write "Hello" %>
>
> <head>....</head>
> <body>....</Body>
>
>
> 2. Placing code in the Head
>
> <head> <% Response.write "Hello" %> </head>
> <body>....</Body>
>
>
> 3. Placing code in Body
>
> <head>.....</head>
> <body> <% Response.write "Hello" %> </body>
>


From ASP's perspective <head> or <body> have no meaning, they are simply
chunks of literal strings that need to be sent to the client. These tags
only have meaning to browser client that is able to a parse HTML.

When outputting HTML whether ASP code that generates content should be in
the head, the body or anywhere else depends on where the content belongs.

For example you would not place code that dynamically outputs HTML table in
the head neither would you place code that dynamically generates meta tags
in the body.

--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
 
 
 
Dave Anderson
Guest
Posts: n/a
 
      04-23-2008
Anthony Jones wrote:
>> I want to know the difference and effect of placing ASP Code
>> in the begining of .asp File and placing code inside <Head>
>> </Head> Tag and Placing code inside <body></body> tag...

>
> From ASP's perspective <head> or <body> have no meaning, they
> are simply chunks of literal strings that need to be sent to
> the client. These tags only have meaning to browser client
> that is able to a parse HTML...


While it is true that the ASP parser does not care a whit about the text of
the Response stream, it should be noted that there is at least one
circumstance under which it is imperative that the server-side processing
precede any output.

If the script reaches the decision to send a Response.Redirect(), for
example, the body of the response must be empty. This has been transparent
to most ASP programmers, as buffering has defaulted to [True] since IIS 5.
But in the odd case that buffering is disabled, any Response.Redirect() call
must precede any output to the response body.



--
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GeForce 7800 GTX Head-to-Head @ TrustedReviews Silverstrand Front Page News 0 09-12-2005 11:25 PM
Re: Can I get at contents of <head></head> programmatically? Karl ASP .Net 0 09-15-2004 06:09 PM
PHP and ASP.NET go HEAD to HEAD showme ASP .Net 13 07-10-2004 09:44 PM
Looking for a Multi-Head, Detachable-Head Camera Richard Alexander Digital Photography 9 05-26-2004 09:26 PM
Injecting code into the <head></head> section Brian W ASP .Net 10 07-02-2003 07:53 PM



Advertisments