Hi,
I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this time,
I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my
MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the
instance in the HTTPContext.Cur rent.Cache... and provide a static method so
other controls can have access to the ImagePreloader. .. On a P IV 3Ghz,
WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP Pro
SP2, IIS 5, It sometimes happen that when other controls want to get the
instance in their PreRender events (so way after the OnInit), the instance
has never been created... If I put a breakpoint in the OnInit of the
ImagePreloader, it never gets there even tought it's a control in the aspx
of the masterpage... Maybe it's not related to speed at all, but I really
don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusic 5 1310
Hi there,
I think entitre logic yore are based on is wrong. What do you mean by 'I put
the instance in the HTTPContext.Cur rent.Cache'? Could you provide some code
to show us what are you doing? I suspect you put an instance to cache, and
this instance is reused in every request (which is not acceptable because
different threads work on the same control ?!) did i get you right?
--
Milosz
"ThunderMus ic" wrote:
Hi,
I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this time,
I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my
MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the
instance in the HTTPContext.Cur rent.Cache... and provide a static method so
other controls can have access to the ImagePreloader. .. On a P IV 3Ghz,
WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP Pro
SP2, IIS 5, It sometimes happen that when other controls want to get the
instance in their PreRender events (so way after the OnInit), the instance
has never been created... If I put a breakpoint in the OnInit of the
ImagePreloader, it never gets there even tought it's a control in the aspx
of the masterpage... Maybe it's not related to speed at all, but I really
don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusic
Hi,
I think you didn't get me right, but maybe it's me that didn't get the thing
right... I put the instance in the HTTPContext so all requests (from other
controls on the page) from this request (this user request to the page) have
an instance to work with... I want it to work as a singleton, but for one
webrequest only... just like the ScriptManager of ASP.NET Ajax (which I
don't use)... I think I've done it tought... I finally found the problem
was reproduced everytime I hit the reload button, so I looked at what was
called after that and surprisingly, everything is called, but the instance
does not stay in cache after the constructor, neither after the OnInit
event, but it does after the OnLoad event (go figure), so I put it there,
because my controls use it in the PreRender anyway... ;)
I use exactly this line in the constructor and the OnLoad of the
ImagePreloader WebControl :
HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Thanks to all, and I hope I helped others if they need this kind of
behavior...
ThunderMusic
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message
news:7E******** *************** ***********@mic rosoft.com...
Hi there,
I think entitre logic yore are based on is wrong. What do you mean by 'I
put
the instance in the HTTPContext.Cur rent.Cache'? Could you provide some
code
to show us what are you doing? I suspect you put an instance to cache, and
this instance is reused in every request (which is not acceptable because
different threads work on the same control ?!) did i get you right?
--
Milosz
"ThunderMus ic" wrote:
>Hi, I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this time, I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the instance in the HTTPContext.Cur rent.Cache... and provide a static method so other controls can have access to the ImagePreloader. .. On a P IV 3Ghz, WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP Pro SP2, IIS 5, It sometimes happen that when other controls want to get the instance in their PreRender events (so way after the OnInit), the instance has never been created... If I put a breakpoint in the OnInit of the ImagePreloader , it never gets there even tought it's a control in the aspx of the masterpage... Maybe it's not related to speed at all, but I really don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusic
ok, I said it too quick... it does not always work... It crashes regularly
on Netscape... and it goes in the constructor, it goes in the OnLoad, then
when my controls request for it in their OnPreRender, it says it does not
exist... Anyone have an idea of what could be the cause? what is the use
of putting something the the Context cache if it does not stay there? Where
should I put it then?
Thanks
ThunderMusic
"ThunderMus ic" <No************ *************@N oSpAm.comwrote in message
news:Ou******** ******@TK2MSFTN GP04.phx.gbl...
Hi,
I think you didn't get me right, but maybe it's me that didn't get the
thing right... I put the instance in the HTTPContext so all requests
(from other controls on the page) from this request (this user request to
the page) have an instance to work with... I want it to work as a
singleton, but for one webrequest only... just like the ScriptManager of
ASP.NET Ajax (which I don't use)... I think I've done it tought... I
finally found the problem was reproduced everytime I hit the reload
button, so I looked at what was called after that and surprisingly,
everything is called, but the instance does not stay in cache after the
constructor, neither after the OnInit event, but it does after the OnLoad
event (go figure), so I put it there, because my controls use it in the
PreRender anyway... ;)
I use exactly this line in the constructor and the OnLoad of the
ImagePreloader WebControl :
HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Thanks to all, and I hope I helped others if they need this kind of
behavior...
ThunderMusic
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message
news:7E******** *************** ***********@mic rosoft.com...
>Hi there,
I think entitre logic yore are based on is wrong. What do you mean by 'I put the instance in the HTTPContext.Cur rent.Cache'? Could you provide some code to show us what are you doing? I suspect you put an instance to cache, and this instance is reused in every request (which is not acceptable because different threads work on the same control ?!) did i get you right? -- Milosz
"ThunderMusi c" wrote:
>>Hi, I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this time, I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the instance in the HTTPContext.Cur rent.Cache... and provide a static method so other controls can have access to the ImagePreloader. .. On a P IV 3Ghz, WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP Pro SP2, IIS 5, It sometimes happen that when other controls want to get the instance in their PreRender events (so way after the OnInit), the instance has never been created... If I put a breakpoint in the OnInit of the ImagePreloade r, it never gets there even tought it's a control in the aspx of the masterpage... Maybe it's not related to speed at all, but I really don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusi c
Hi again
I'm afraid i got you right.
HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Adds instance to cache and will be used in many request threads so don't
expect it's gonna work. I think you misused cache with context items - it
should have been:
HttpContext.Cur rent.Items["ImagePreloader "].
In addtion to that there is better way to access current request execution
Context from web user control:
this.Context.It ems["ImagePreloader "]
or from web custom control:
this.Context.It ems["ImagePreloader "]
Hope it's clear now.
--
Milosz
"ThunderMus ic" wrote:
Hi,
I think you didn't get me right, but maybe it's me that didn't get the thing
right... I put the instance in the HTTPContext so all requests (from other
controls on the page) from this request (this user request to the page) have
an instance to work with... I want it to work as a singleton, but for one
webrequest only... just like the ScriptManager of ASP.NET Ajax (which I
don't use)... I think I've done it tought... I finally found the problem
was reproduced everytime I hit the reload button, so I looked at what was
called after that and surprisingly, everything is called, but the instance
does not stay in cache after the constructor, neither after the OnInit
event, but it does after the OnLoad event (go figure), so I put it there,
because my controls use it in the PreRender anyway... ;)
I use exactly this line in the constructor and the OnLoad of the
ImagePreloader WebControl :
HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Thanks to all, and I hope I helped others if they need this kind of
behavior...
ThunderMusic
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message
news:7E******** *************** ***********@mic rosoft.com...
Hi there,
I think entitre logic yore are based on is wrong. What do you mean by 'I
put
the instance in the HTTPContext.Cur rent.Cache'? Could you provide some
code
to show us what are you doing? I suspect you put an instance to cache, and
this instance is reused in every request (which is not acceptable because
different threads work on the same control ?!) did i get you right?
--
Milosz
"ThunderMus ic" wrote:
Hi,
I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this
time,
I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my
MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the
instance in the HTTPContext.Cur rent.Cache... and provide a static method
so
other controls can have access to the ImagePreloader. .. On a P IV 3Ghz,
WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP
Pro
SP2, IIS 5, It sometimes happen that when other controls want to get the
instance in their PreRender events (so way after the OnInit), the
instance
has never been created... If I put a breakpoint in the OnInit of the
ImagePreloader, it never gets there even tought it's a control in the
aspx
of the masterpage... Maybe it's not related to speed at all, but I really
don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusic
thanks a lot, I'll try this... I knew I was missing something... thanks
I'll let you know if it works...
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message
news:2F******** *************** ***********@mic rosoft.com...
Hi again
I'm afraid i got you right.
HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Adds instance to cache and will be used in many request threads so don't
expect it's gonna work. I think you misused cache with context items - it
should have been:
HttpContext.Cur rent.Items["ImagePreloader "].
In addtion to that there is better way to access current request execution
Context from web user control:
this.Context.It ems["ImagePreloader "]
or from web custom control:
this.Context.It ems["ImagePreloader "]
Hope it's clear now.
--
Milosz
"ThunderMus ic" wrote:
>Hi, I think you didn't get me right, but maybe it's me that didn't get the thing right... I put the instance in the HTTPContext so all requests (from other controls on the page) from this request (this user request to the page) have an instance to work with... I want it to work as a singleton, but for one webrequest only... just like the ScriptManager of ASP.NET Ajax (which I don't use)... I think I've done it tought... I finally found the problem was reproduced everytime I hit the reload button, so I looked at what was called after that and surprisingly, everything is called, but the instance does not stay in cache after the constructor, neither after the OnInit event, but it does after the OnLoad event (go figure), so I put it there, because my controls use it in the PreRender anyway... ;)
I use exactly this line in the constructor and the OnLoad of the ImagePreload er WebControl : HttpContext.Cur rent.Cache["ImagePreloader "] = this;
Thanks to all, and I hope I helped others if they need this kind of behavior...
ThunderMusic
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message news:7E******* *************** ************@mi crosoft.com...
Hi there,
I think entitre logic yore are based on is wrong. What do you mean by
'I
put
the instance in the HTTPContext.Cur rent.Cache'? Could you provide some
code
to show us what are you doing? I suspect you put an instance to cache,
and
this instance is reused in every request (which is not acceptable
because
different threads work on the same control ?!) did i get you right?
--
Milosz
"ThunderMus ic" wrote:
Hi, I always refer to this page to know the order of events in a page : http://weblogs.asp.net/jeff/archive/...04/172683.aspx but this time, I'm mystified...
I have a Control called "ImagePreloader " I placed in the head of my MasterPage (aspx)... in the Init of the "ImagePreloader ", I put the instance in the HTTPContext.Cur rent.Cache... and provide a static method so other controls can have access to the ImagePreloader. .. On a P IV 3Ghz, WinXP Pro SP2, IIS 5, everything works fine... On a P III 1Ghz, WinXP Pro SP2, IIS 5, It sometimes happen that when other controls want to get the instance in their PreRender events (so way after the OnInit), the instance has never been created... If I put a breakpoint in the OnInit of the ImagePreloader , it never gets there even tought it's a control in the aspx of the masterpage... Maybe it's not related to speed at all, but I really don't know what can cause this...
can anyone help me please?
Thanks
ThunderMusic
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ChrisB |
last post by:
I'm attempting to open a new window from a LinkButton in a DataGrid.
I can set a session variable in the ItemCommand event for the
LinkButton like so:
// this is used to handle the ItemCommand event
private void itmCmd(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string itemGFNo = "";
if (e.CommandName == "EditTask")
|
by: José Joye |
last post by:
Hello,
I'm playing around with dynamically loading user controls ...and having
problems
I created a really simple userControl (in fact contains a plain text box)
and placed it into the MyTestCtrl2.ascx file.
In an aspx file I placed the following in the Page_Load method:
|
by: Tim |
last post by:
I am trying to load both server and user controls into placeholder
controls on a aspx template page at runtime. These values would be
strings that are returned from a database query. I know I can do this
for user controls easily using:
oContent = (ControlBase) Page.LoadControl(Session + ".ascx");
this.plcContent.Controls.Add(oContent);
but can not figure out how to do it for server controls. since I do
not know what the control...
|
by: Dave A |
last post by:
I just don't get this...
If I need to dynamically load controls into a web page I simply need to go PlaceHolder1.Controls.Add(new Button()); or similar. However when I need to dynamically load a web user control into a web page then if we use the same syntax it will appear to work but the web control will throw all sorts of null reference exceptions.
Rather for web user controls you have to use the syntax ...
|
by: Joe |
last post by:
Hello All:
Do I have to use the LoadControl method of the Page to load a UserControl?
I have a class which contains three methods (one public and two private).
The class acts as a control server. It "serves" back the required control
(either WebControl or UserControl) based on the contents of an xml file. The
code in the webform places each control in a TableCell.
My problem is that the control server works as far as returning the...
| |
by: Danny |
last post by:
Hi,
I've create a usercontrol with a Calendar Control and a Textbox. The
SelectionChanged event of the calendar populates the textbox with the
selected date.
Also, I've created an aspx page with an ASP Table on the page.
|
by: Mark Denardo |
last post by:
My question is similar to one someone posted a few months back, but I don't
see any replies.
Basically I want to be able to have users upload photos and save them in a
database (as byte data) and be able to load them to an image webcontrol, but
system.web.ui.webcontrols.image only seems to have a control to load the
image from a URL.
There's no way to load this directly without saving the image as a file and
then using...
|
by: Jacob Donajkowski |
last post by:
Once the user logs in I want to have the users switch from the Roster
View to the Profile View and enter their profile infomation and save
it. Then the next time they login and go to the Profile View I want
the form populated from there profile on the sql server. The code to
save the profile works fine. But when the user logs back in they data
doesn't load back to the form. The multiview is located inside the
LoginView's Logged-In View ....
|
by: =?Utf-8?B?V2FubmFiZQ==?= |
last post by:
We have a page that is loading very slow. There is not a lot of data, not a
lot of users are connected at the same time and the page does not produce an
error, so I am not sure where to start to look for why it is slowing down. I
thought about the DB first and added NOLOCK to a couple of stored procedures
that were being run, but with no effect. Can someone offer some tips on where
to start looking or how I can begin to diagnose this...
|
by: Vili |
last post by:
Hi all
I am having problems with creating an functional questionnaire with
asp.net 2.0 and MSSQL 2005 database.
I have a table with field id (key & auto int), clientId (int),
QuestionId (int), And answer (nvarchar(255)) and a set of questions on
an another table.
Questions can have 0 or more answers
|
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...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |