System.Threading.Timer to refresh data - security problems

System.Threading.Timer to refresh data - security problems

Old forum URL: forums.lhotka.net/forums/t/2467.aspx


brucep posted on Friday, March 02, 2007

Hi:

I have a website that that has a /public directory, so I created a /public/web.config file and in that file I set the Authentication token to "Windows". Everything works fine for normal pages that need to show data, if the query takes place in that *.aspx page. However, I have one page that calls into a static class (in the App_Code directory). This static class uses a System.Threading.Timer (I tried using a System.Timers.Timer but it swallows all exceptions so I couldn't find out why it wasn't working). When the timer calls the callback method after the set interval, it of course is called on a new thread. That is apparently where my problem is. I get a SecurityException that says the principal is of the wrong type. I even tried explicitly setting the DataPortal.Authentication directly to "Windows" inside the callback method, and this didn't work either.

Any help here?

--Bruce

Copyright (c) Marimer LLC