473,410 Members | 1,930 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,410 software developers and data experts.

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>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 thread executed
with <machine>ASPNET identity.

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

Thanks.

brian
Jul 21 '05 #1
3 3617
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****@palcotelecom.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>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 thread executed
with <machine>ASPNET 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****@palcotelecom.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>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 thread executed with <machine>ASPNET 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 (ServicedComponent) 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****@palcotelecom.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****@palcotelecom.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>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 thread executed with <machine>ASPNET 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
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...
6
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...
8
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...
3
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...
3
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...
5
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...
2
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...
5
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...
3
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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
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...
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...
0
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...

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.