473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

AddHeader is not working

I am trying to add a new header to the HTML when a webform loads. But it
does not seem to work.
I need to get this working in a Sharepoint webpart so adding it to the HTML
page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")
Thanks in advance,
Rick
Nov 19 '05 #1
7 1617
Rick wrote:
I am trying to add a new header to the HTML when a webform loads. But
it does not seem to work. I need to get this working in a Sharepoint
webpart so adding it to the HTML page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")


You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2
Ok, Thanks!

But do you know how I can add, programatically, the following line in the
HTML code:
<meta http-equiv="refresh" content="600"> ?

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Rick wrote:
I am trying to add a new header to the HTML when a webform loads. But
it does not seem to work. I need to get this working in a Sharepoint
webpart so adding it to the HTML page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")


You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #3
That would have to go into the <head> section of the document. Another
option would be to add a JavaScript. Example:

<script type=text/javascript><!--
function refresh()
{
var s = document.location.href;
window.location = s;
}
setTimeout(refresh, 1000);
--></script>

Note that the time is in milliseconds.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Rick" <te**@test.com> wrote in message
news:e2**************@TK2MSFTNGP14.phx.gbl...
Ok, Thanks!

But do you know how I can add, programatically, the following line in the
HTML code:
<meta http-equiv="refresh" content="600"> ?

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Rick wrote:
I am trying to add a new header to the HTML when a webform loads. But
it does not seem to work. I need to get this working in a Sharepoint
webpart so adding it to the HTML page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")


You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de


Nov 19 '05 #4
I realize that it needs to be in the <head> section, my problem is, I'm not
sure How to get it there from the page load event of VS.net. I have to put
this into a webpart, which I am not sure how to get to the HTML through
webpart code(VB.NET). One problem I have with the Java script, is it would
need to be added as an "onload" to the <body> tag, which does not have an
ID, If I had an ID I could easily add it to the Body tag like this:
myBody.Attributes.Add("onload", "javascript:
setInterval('location.reload();', 4000)")

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
That would have to go into the <head> section of the document. Another
option would be to add a JavaScript. Example:

<script type=text/javascript><!--
function refresh()
{
var s = document.location.href;
window.location = s;
}
setTimeout(refresh, 1000);
--></script>

Note that the time is in milliseconds.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"Rick" <te**@test.com> wrote in message
news:e2**************@TK2MSFTNGP14.phx.gbl...
Ok, Thanks!

But do you know how I can add, programatically, the following line in the
HTML code:
<meta http-equiv="refresh" content="600"> ?

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Rick wrote:

I am trying to add a new header to the HTML when a webform loads. But
it does not seem to work. I need to get this working in a Sharepoint
webpart so adding it to the HTML page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")

You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de



Nov 19 '05 #5
You won't be able to add anything to the <head> tag in a WebPart. That's why
I posted the alternative. Also, it's not necessary to put it into the onload
of the body tag. Any JavaScript that isn't in a function block is executed
immediately. So, if you want to use your version, just put a script with
your code in it anywhere in the page. that would include inside a WebPart.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Rick" <te**@test.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I realize that it needs to be in the <head> section, my problem is, I'm not
sure How to get it there from the page load event of VS.net. I have to put
this into a webpart, which I am not sure how to get to the HTML through
webpart code(VB.NET). One problem I have with the Java script, is it would
need to be added as an "onload" to the <body> tag, which does not have an
ID, If I had an ID I could easily add it to the Body tag like this:
myBody.Attributes.Add("onload", "javascript:
setInterval('location.reload();', 4000)")

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
That would have to go into the <head> section of the document. Another
option would be to add a JavaScript. Example:

<script type=text/javascript><!--
function refresh()
{
var s = document.location.href;
window.location = s;
}
setTimeout(refresh, 1000);
--></script>

Note that the time is in milliseconds.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"Rick" <te**@test.com> wrote in message
news:e2**************@TK2MSFTNGP14.phx.gbl...
Ok, Thanks!

But do you know how I can add, programatically, the following line in
the HTML code:
<meta http-equiv="refresh" content="600"> ?

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Rick wrote:

> I am trying to add a new header to the HTML when a webform loads. But
> it does not seem to work. I need to get this working in a Sharepoint
> webpart so adding it to the HTML page is not an option.
>
> Can anyone tell me of another way or what I'm doing wrong?
> I've tried the following in the Page Load Event.
>
> Response.AppendHeader("Test", "Test")
> Response.AddHeader("Test", "Test")
> context.response.addheader("test","test")
> context.response.appendheader("test","test")

You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de



Nov 19 '05 #6
I figured it out: I didn't realize you could just register a javascript and
it would run without user action. Anyway this is how it was done:

Dim sScript As String

sScript = "<script language='javascript'>"
sScript += "setInterval('location.reload();', 4000);"
sScript += "</script>"

If Not Page.IsClientScriptBlockRegistered("refreshscript" ) Then
Page.RegisterClientScriptBlock("refreshscript", sScript)
End If

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
That would have to go into the <head> section of the document. Another
option would be to add a JavaScript. Example:

<script type=text/javascript><!--
function refresh()
{
var s = document.location.href;
window.location = s;
}
setTimeout(refresh, 1000);
--></script>

Note that the time is in milliseconds.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

"Rick" <te**@test.com> wrote in message
news:e2**************@TK2MSFTNGP14.phx.gbl...
Ok, Thanks!

But do you know how I can add, programatically, the following line in the
HTML code:
<meta http-equiv="refresh" content="600"> ?

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Rick wrote:

I am trying to add a new header to the HTML when a webform loads. But
it does not seem to work. I need to get this working in a Sharepoint
webpart so adding it to the HTML page is not an option.

Can anyone tell me of another way or what I'm doing wrong?
I've tried the following in the Page Load Event.

Response.AppendHeader("Test", "Test")
Response.AddHeader("Test", "Test")
context.response.addheader("test","test")
context.response.appendheader("test","test")

You're confusing HTML with HTTP. You cannot use HTTP headers as HTML
elements.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de



Nov 19 '05 #7
Rick wrote:
Ok, Thanks!

But do you know how I can add, programatically, the following line in
the HTML code: <meta http-equiv="refresh" content="600"> ?


Uh, why also these crappy META tags? You can do a Refresh in HTTP as
well -- though it's non-standard, it's widely supported.

Response.AppendHeader("Refresh", "600");

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bertrand | last post by:
Hello, I am using an ASP form to collect some info from users, that info is them inserted into an Excel file (copy of a template that resides on the server .. I use fso.copy to copy the...
3
by: Craig Haywood | last post by:
Hi there, Can anyone please give me an actual example in code on how to add a header for the "HTTP/1.1 202 (Accepted)" response code I have searched the web high and low and all I can find is...
2
by: Joseph | last post by:
Hello. I have this problem. See I have a transformed XML file and I checked its contents prior to outputting it to excel file via responseset. here is the gist of the code: XmlReader reader =...
0
by: S.Kartikeyan | last post by:
I read previous posts in the group regarding Response.AddHeader("content-disposition","filename:somefilename"); My aim is to send a file from aspx page with some file name. when the page is...
1
by: Frank Bishop | last post by:
I am having problems downloading an Excel file after I export it with another procedure. When I look at the file after export, it looks fine, but when I use the sub below, it rearranges all the...
1
by: Incorrect filenames in download link. | last post by:
Hi experts, I am giving filename as "clearbenefits.infosys.txt" to Response.AddHeader as filename parameter. After clicking the download link filename on dialogbox is showing as...
10
by: Michael | last post by:
I have a IIS web site that works fine on one server but not another. I do not know if the problem is an IIS setting or something else so I will try to include as much detail as I have figured out...
1
by: Andyza | last post by:
With reference to the ASPFAQ 2161 article - http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html Does the 'Content-Disposition' code work if the...
8
by: Tony | last post by:
I've searched the web & can't find an answer to this. Is it possible to successfully use Response.AddHeader for a robots meta tag? For example, I want to do <% IF request("PageID") = 252...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.