Assembly for Client/Server AND Web

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a C# assembly for logging messages. One option I
would like is to also display the message to the user.
It's easy if I know whether the caller is a Client/Server
app or a Web app. My question is, is there any way for my
code to determine whether the caller is a web app (and
has a page object I can use) or just a "normal" app that
I can write to the console?
If so, how would I get access to the callers current web
page object?

Thanks
Bob
 
Well, you can check System.Web.HttpContext.Current property. If it is null,
then there is no current web context for this.

It then has things like the Response property, so you can Response.Write or
whatever, and all the other properties you should need.

However, if the caller is a web service, then you would sitll have a web
context, but response.write wouldn't be the way to go there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top