473,327 Members | 2,007 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,327 software developers and data experts.

add a script in global.asax

hi,
I want to add a script(window.open script actually) in global.asax, for example
Application_BeginRequest. I used Response.Write but opened page locked however main page
doesn't. Main page loaded normally.
How can I add a script in global.asax.
Thanks for your help
Nov 18 '05 #1
3 2596
You cannot access Response object in Global.asax.

The alternative for you is to set a variable in global.asax page and check
that variable in the actual page to do the window.open action.

Sekhar.

"caldera" <ca*****@cc.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi,
I want to add a script(window.open script actually) in global.asax, for example Application_BeginRequest. I used Response.Write but opened page locked however main page doesn't. Main page loaded normally.
How can I add a script in global.asax.
Thanks for your help

Nov 18 '05 #2
sure you can. provide a routine which takes a reference to the response
object
myfunct(ref response.current instance){ instance.write("blah blah blah")}
roughly

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Chandra Sekhar" <Ch*************@am.joneslanglasalle.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
You cannot access Response object in Global.asax.

The alternative for you is to set a variable in global.asax page and check
that variable in the actual page to do the window.open action.

Sekhar.

"caldera" <ca*****@cc.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi,
I want to add a script(window.open script actually) in global.asax, for

example
Application_BeginRequest. I used Response.Write but opened page locked

however main page
doesn't. Main page loaded normally.
How can I add a script in global.asax.
Thanks for your help


Nov 18 '05 #3
"caldera" <ca*****@cc.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
hi,
I want to add a script(window.open script actually) in global.asax, for example Application_BeginRequest. I used Response.Write but opened page locked however main page doesn't. Main page loaded normally.
How can I add a script in global.asax.

What are you trying to accomplish? Why would you want every single request
to get this window.open script?

If you absolutely must have every page begin with this code, then you should
create a base class for all of your pages to derive from. The base class
would derive from Page. It would have no UI. It should override the
OnPreRender method and add:

Protected Overrides Sub OnPreRender(e As EventArgs)
Page.RegisterStartupScript("common", "<script>window.open ...
</script>")
MyBase.OnPreRender(e)
End Sub

If all of your pages inherit from that base class, they'll all register the
same startup script.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #4

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

Similar topics

12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
2
by: BookerW | last post by:
Ok, here is the situation. I have some vb code that was upgraded to the earliest asp, I believe. When i run this snippet of code below on my local xp box with iis and visual studio 2003...
11
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the...
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.