473,761 Members | 5,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timer Thread Identity

I have an ASP.Net application that uses impersonation.
This works fine for accessing/executing the application.
However, the app utilizes a timer, that when fired uses
the <machine>ASPN ET identity.

In order to correct this problem I've modified the
Machine.config file in the
\Microsoft.Net\ Framework\v1.1. 4322 folder. However, this
didn't solve the problem; instead of using the user id and
password specified in Machine.Config, the thread executed
with <machine>ASPN ET identity.

I sure would appreciate it if someone could shine some
light on this issue for me.

Thanks.

brian
Jul 21 '05 #1
3 3640
Timer delegates are run on threadpool threads, these are running in the security context of the process (asp.net) not the context of
the calling thread.
There is nothing you can do about this.
Question you should ask yourself:
- why do you use timers in asp.net applications in the first place, and second why do you execute code in a timer event handler
which requires a certain security context?

Willy.

"brian" <bd****@palcote lecom.com> wrote in message news:04******** *************** *****@phx.gbl.. .
I have an ASP.Net application that uses impersonation.
This works fine for accessing/executing the application.
However, the app utilizes a timer, that when fired uses
the <machine>ASPN ET identity.

In order to correct this problem I've modified the
Machine.config file in the
\Microsoft.Net\ Framework\v1.1. 4322 folder. However, this
didn't solve the problem; instead of using the user id and
password specified in Machine.Config, the thread executed
with <machine>ASPN ET identity.

I sure would appreciate it if someone could shine some
light on this issue for me.

Thanks.

brian

Jul 21 '05 #2
Willy. The reason I am using a timer is that I have users
adding records to a folder. It is important that the
contents of this folder be written to SQL Server on a
regular interval, hence the timer. However, you do make at
least one valid point; why use a timer? Granted this tool
is available for me to use, but I could just as easily use
a counter, and write the contents of the folder to SQL
Server everytime the document count reaches 100.

brian

-----Original Message-----
Timer delegates are run on threadpool threads, these are running in the security context of the process (asp.net)
not the context ofthe calling thread.
There is nothing you can do about this.
Question you should ask yourself:
- why do you use timers in asp.net applications in the first place, and second why do you execute code in a timer
event handlerwhich requires a certain security context?

Willy.

"brian" <bd****@palcote lecom.com> wrote in message

news:04******** *************** *****@phx.gbl.. .
I have an ASP.Net application that uses impersonation.
This works fine for accessing/executing the application.
However, the app utilizes a timer, that when fired uses
the <machine>ASPN ET identity.

In order to correct this problem I've modified the
Machine.config file in the
\Microsoft.Net\ Framework\v1.1. 4322 folder. However, this
didn't solve the problem; instead of using the user id and password specified in Machine.Config, the thread executed with <machine>ASPN ET identity.

I sure would appreciate it if someone could shine some
light on this issue for me.

Thanks.

brian

.

Jul 21 '05 #3
Brian,
The purpose of my question was, how do you synchronize both, the service time (time to handle the asp request) and the timer
interval?
If the former is shorter than the latter, your page object could be GC'd before the timer expires, unless you take some precautions,
you will lose the timer event.
A possible solution to your problem windows identity doesn't flow when using threadpool threads (and delegates)' is to move (part
of) your DB updates to a COM+ server-type component (ServicedCompon ent) running with a fixed identity.
Each time the timer fires you simply call (synchronously) a method on the component, you could even make the call asynchronous by
using MSMQ.

Willy.

"brian" <bd****@palcote lecom.com> wrote in message news:05******** *************** *****@phx.gbl.. .
Willy. The reason I am using a timer is that I have users
adding records to a folder. It is important that the
contents of this folder be written to SQL Server on a
regular interval, hence the timer. However, you do make at
least one valid point; why use a timer? Granted this tool
is available for me to use, but I could just as easily use
a counter, and write the contents of the folder to SQL
Server everytime the document count reaches 100.

brian

-----Original Message-----
Timer delegates are run on threadpool threads, these are

running in the security context of the process (asp.net)
not the context of
the calling thread.
There is nothing you can do about this.
Question you should ask yourself:
- why do you use timers in asp.net applications in the

first place, and second why do you execute code in a timer
event handler
which requires a certain security context?

Willy.

"brian" <bd****@palcote lecom.com> wrote in message

news:04******** *************** *****@phx.gbl.. .
I have an ASP.Net application that uses impersonation.
This works fine for accessing/executing the application.
However, the app utilizes a timer, that when fired uses
the <machine>ASPN ET identity.

In order to correct this problem I've modified the
Machine.config file in the
\Microsoft.Net\ Framework\v1.1. 4322 folder. However, this
didn't solve the problem; instead of using the user id and password specified in Machine.Config, the thread executed with <machine>ASPN ET identity.

I sure would appreciate it if someone could shine some
light on this issue for me.

Thanks.

brian

.

Jul 21 '05 #4

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

Similar topics

8
2784
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get called? private System.Windows.Forms.Timer timerDF; this.timerDF = new System.Windows.Forms.Timer(this.components);
6
2880
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a TimerState object similar to the example in the System.Threading.Timer documentation. The method which handles the timer events, among other things, periodically calls a method in this TimerState object which raises an event to the startup form,...
8
3344
by: theinvisibleGhost | last post by:
I think I've found a bug in the timer control. I've got a class which uses a timer control. It imports it from System.Windows.Forms This timer ticks once a second, and then updates a label which represents a clock on a form, to which the original class has a reference. (MVC style) If the user clicks and holds the X button on the form
3
5972
by: mjheitland | last post by:
Hi, I like to know how many threads are used by a Threading.Timer object. When I create a Threading.Timer object calling a short running method every 5 seconds I expected to have one additional ThreadPool thread. And that is exactly what MS VIsual Studio shows. But when I run Processexplorer or Taskmanager I see 2 additional threads, after a while another 2 additional threads. With the 3 threads at start time we have totally 7 threads.
3
247
by: brian | last post by:
I have an ASP.Net application that uses impersonation. This works fine for accessing/executing the application. However, the app utilizes a timer, that when fired uses the <machine>ASPNET identity. In order to correct this problem I've modified the Machine.config file in the \Microsoft.Net\Framework\v1.1.4322 folder. However, this didn't solve the problem; instead of using the user id and password specified in Machine.Config, the...
5
5747
by: Brian | last post by:
I have an file based asp.net application the creates a thread to do some background printing. It works fine but when the application is deployed on a web server, the following error occurs in the thread when it accesses SQL: Login failed for user ''. The user is not associated with a trusted SQL Server connection. Note the blank user. It seems that the new thread does not have the credentials but looking at "Thread.CurrentPrincipal",...
2
1992
by: RP | last post by:
I have a Timer control on a form. When this Timer starts, it will do certain task on every tick. I want that this Timer be linked to a new thread so that the Timer does not disturb other activities. How to create a new thread and link this Timer to it?
5
18917
by: Kate77 | last post by:
Hello, Im trying to do something very simple but having problems.. What I want to accomplish sounds simple but I cant find anywhere on the web answer of how to do that so it will work. I want to run a thread , for example map the files on the hard drive. now what I want to do is run a timer that will check the thread state so when it is finish the timer will run a second thread that will map the files on the hard drive again but with...
3
3884
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI Thread)? In some of the timers I update some UI controls e.g statusbar.labels and I
0
9554
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
10136
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
9989
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
9925
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,...
0
9811
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 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...
1
7358
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
6640
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();...
1
3913
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
2788
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.