Hi Murtaza,
Yes I have been playing around and you are obviously right. To get
around this problem I started hard coding som file paths, then
hardcoding some other values at which point it was dawning on me that
this kind of service really needs to be instantiated in a place other
than the Global of the website.
I made the decision after trawling google and finsing advice not to put
these kind of services in the website. Developing a small application
that I will install now.
Thanks for your pointers
Regards
Richard
Murtaza wrote:
Well , if you are using Context then it is totally wrong, u cannot access
this HttpContext directly in Global.asax, simply because there is no session
behind it or your are not pointing to any Session, try this thing,
in Global.asax make a function
public void testa()
{
Server.MapPath("ABC");// this wont be null : tested
}
"rgparkins" wrote:
Hi Guys
Maybe a simple and easy solution to this, but I keep getting exception
object not set to instance etc etc.
I have a Timer that is initiated in Application_Start in Global.asax.
This timer I am using as a service every 10 minutes to send email to
users. OK so all is fine until I need to load a file from the server
(in fact an email template).
I am using HttpContext.Current.Server.MapPath to access the Server
object BUT its null, which I guess is correct as the timer is running
in its own thread.
Simple solution, anybody know how to gain access to this object from
within a Timer started from Global.asax
Really appreciate your help with this one, I have searched groups and
the web but obviously putting in the wrong search terms as I am getting
nothing back, or is it that simple?
regards
Richard