473,769 Members | 7,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question on global.ascx

i want to keep a global variable or a session in global.ascx when ever a user
access this particular page. at certain time, this page will do a infinit
loop, and i want to set a variable to allow it to only loop how many times i
want. e.g 3 times and quit. how can i get this done?
Nov 18 '05 #1
1 1359
Asha,
You ask an interesting (as in odd) question. First off, if this is for a
particular page, why not place it in this page, instead of the Application?
Also, why do you have code that does infinite loop? is this a bug or by
design? I think you might be trying to solve your problem the wrong way.

However, without knowing more about your problem, I might try something like
this:

Global.asax:
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
Dim path As String = Request.Url.Abs olutePath
If path.ToUpper() = "/PATH/PAGE.ASPX" Then
Context.Items.A dd("maxLoop",
System.Configur ation.Configura tionSettings.Ap pSettings("maxL oop"))
End If
End Sub

your page:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
dim maxLoop as integer = cint(Context.It em("maxLoop"))
End Sub
Again, not sure why you want to use global.asax for this and not do the
logic in the page, and also not sure this is even the right way to solve
your problem.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Asha" <As**@discussio ns.microsoft.co m> wrote in message
news:AE******** *************** ***********@mic rosoft.com...
i want to keep a global variable or a session in global.ascx when ever a user access this particular page. at certain time, this page will do a infinit
loop, and i want to set a variable to allow it to only loop how many times i want. e.g 3 times and quit. how can i get this done?

Nov 18 '05 #2

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

Similar topics

0
1845
by: George Durzi | last post by:
I have a C# in my web application called BasePage. It inherits from System.Web.UI.Page. I'm using page inheritance in my web app so all my pages have an identical look and feel by inheriting from BasePage. In my BasePage class, I have an OnInit method defined as shown: protected override void OnInit(System.EventArgs e) { this.Controls.AddAt(0, LoadControl("_header.ascx")); base.OnInit(e);
1
2812
by: sue chandler via .NET 247 | last post by:
(Type your message here) -------------------------------- From: sue chandler regarding the begin_request event of global.ascx file... can we access page properties from here and how ? ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/)
3
3018
by: Robert Walter | last post by:
I want to user the Page method LoadControl inside the Global.asax.cs but when I instantiate a page and try it I get the following error... System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at...
5
4209
by: Daves | last post by:
emm... what exactly is the difference?! If I want a global file without <script></script> tags could I use global.ascx only like class Global { void Session_Start(Object sender, EventArgs e) {...} }
7
5227
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user folder are using this code of url rewrite project is running completely fine on localhost but after uploading first page (http://emailware.net.temporary.domain.name/user/index.aspx) is fine but as i click 123 Easy-CD Ripper
1
1552
by: Raed Sawalha | last post by:
I have Solution with multiple project as following hierarchy Parent Child Child Child the parent is the ONLY one has the Global.ascx , now im in case i need to access the global.ascx public class (global) of parent project to set a value used there with a specific text, I do not need to add the Parent DLL in each
2
2059
by: TARUN | last post by:
I have a question about declaring the Global.ascx: In VS.NET I create a Solution, and there are 4 projects under it. They are put under 4 folders, but web pages would be called across the 4 projects. For example, web page Page1 in Project1 will redirect to web page Page2 in Project2 which will further redirect to Page3 in project3 and Page4 in Project4 and finally back to Page1. In each web page, some session variables, such as...
0
1432
by: Nathan Sokalski | last post by:
I have several UserControls (*.ascx files) that I register in my Web.config file under the <system.web><pages><controlselement. If I mistype the src attribute in the Web.config file, the pages that use the UserControl will add something such as the following to the *.aspx.designer.vb files: Protected WithEvents mycontrol As Global.System.Web.UI.UserControl This is obviously not correct, because Global.System.Web.UI.UserControl is what...
0
1149
by: =?Utf-8?B?RGFpc3k=?= | last post by:
Situation: 1. have one default.aspx file 2. inside default.aspx file, contains several usercontrol, .ascx file, e.g. 1.ascx, 2.ascx 3. in the 1.ascx file, there is a print button or link 4. when this print button is clicked, it should open a popup window which is the same as 2.ascx except the header, footer and some unnecessary controls in the 2.ascx. Question: 1. what's the best way to handle it?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.