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

Background Thread Error Logging

Hi,

I'm running a long running process on a background thread in an ASP.NET
application and not sure about how to get the path since the
HttpContext.Current object is null. If there is no context, how does one get
the path for the error log?

--
Sincerely,

Mark Fox
Nov 19 '05 #1
3 1238
When you initiated thread, you can always pass the error log path as a
parameter. If your error log path stays the same thorugh out the processing,
this should work.

"Solel Software" <So***********@newsgroup.nospam> wrote in message
news:0D**********************************@microsof t.com...
Hi,

I'm running a long running process on a background thread in an ASP.NET
application and not sure about how to get the path since the
HttpContext.Current object is null. If there is no context, how does one
get
the path for the error log?

--
Sincerely,

Mark Fox

Nov 19 '05 #2
Hi,

I answered my own question:

System.AppDomain.CurrentDomain.BaseDirectory

"Solel Software" wrote:
Hi,

I'm running a long running process on a background thread in an ASP.NET
application and not sure about how to get the path since the
HttpContext.Current object is null. If there is no context, how does one get
the path for the error log?

--
Sincerely,

Mark Fox

Nov 19 '05 #3
Naveen,

Thanks for the suggestion. That would definitely work. I found, though,
that using

System.AppDomain.CurrentDomain.BaseDirectory

will return the path for the application folder even when there is no
HttpContext.Current object, so I'm just using that. If I run into problems,
your method may come in handy!

"Naveen K Kohli" wrote:
When you initiated thread, you can always pass the error log path as a
parameter. If your error log path stays the same thorugh out the processing,
this should work.

"Solel Software" <So***********@newsgroup.nospam> wrote in message
news:0D**********************************@microsof t.com...
Hi,

I'm running a long running process on a background thread in an ASP.NET
application and not sure about how to get the path since the
HttpContext.Current object is null. If there is no context, how does one
get
the path for the error log?

--
Sincerely,

Mark Fox


Nov 19 '05 #4

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

Similar topics

31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
10
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
3
by: ari | last post by:
hey all, i have a shared sub called WriteToErrorLog(msg as String) for obvious purposes. How do i send that to a background thread? i'm stuck on the part where thread.start executes a subroutine...
33
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
3
by: CrashTECH | last post by:
Okay, I have NO idea if this is possible (or a good idea) but I am getting REALLY annoyed... So I wrote this error logging class, to specs. It takes 3 objects as parameters, one for the exception,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...

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.