By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

Verify if a DLL is used in ASP.NET application or Windows application

P: n/a
Hello

I have a managed class library (written in C#) that is used both in ASP.NET
and Windows applications. How can I determine which platform has been called
a class method in this library.

Thanks in advance.

Hamed
Feb 6 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

System.Web.HttpContext.Current will return null in a non-web application.

--
Dave Sexton
http://davesexton.com/blog
http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)

"Hamed" <ha***@raymehr.comwrote in message
news:OK**************@TK2MSFTNGP06.phx.gbl...
Hello

I have a managed class library (written in C#) that is used both in
ASP.NET and Windows applications. How can I determine which platform has
been called a class method in this library.

Thanks in advance.

Hamed

Feb 6 '07 #2

P: n/a
Hi,
>
System.Web.HttpContext.Current will return null in a non-web
application.
True, but it will also return null if "this" call is not due to a webrequest
(for instance something run by a timer or in an extra thread)

Hans Kesting

"Hamed" <ha***@raymehr.comwrote in message
news:OK**************@TK2MSFTNGP06.phx.gbl...
>Hello

I have a managed class library (written in C#) that is used both in
ASP.NET and Windows applications. How can I determine which platform
has been called a class method in this library.

Thanks in advance.

Hamed

Feb 6 '07 #3

P: n/a
Hi,

True, but then dll doesn't have to process as if it is a web application -
because it's not.

--
Dave Sexton
http://davesexton.com/blog
http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)

"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:c0*************************@news.microsoft.co m...
>Hi,

System.Web.HttpContext.Current will return null in a non-web
application.

True, but it will also return null if "this" call is not due to a
webrequest
(for instance something run by a timer or in an extra thread)

Hans Kesting

>"Hamed" <ha***@raymehr.comwrote in message
news:OK**************@TK2MSFTNGP06.phx.gbl...
>>Hello

I have a managed class library (written in C#) that is used both in
ASP.NET and Windows applications. How can I determine which platform
has been called a class method in this library.

Thanks in advance.

Hamed


Feb 6 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.