[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Detect if DLL is running from ASP.NET

Posted on 2010-03-27
1
Medium Priority
?
257 Views
Last Modified: 2012-05-09
Hello,

I've got a DLL that's usually run from within ASP.NET 3.5. However, for unit testing, we need to run it without it. The tested parts can run without ASP.NET, but I would need to detect whether this is being run by nUnit or ASP.NET to initialize a few variables. How can I detect if it was invoked by ASP.NET? Also, what method would you suggest for unit testing of web app code - I want to test various internal function that are not directly exposed to the web or web services, so using a browser-like approach will not work. Thanks in advance.
0
Comment
Question by:bovlk
1 Comment
 
LVL 5

Accepted Solution

by:
pschrama earned 2000 total points
ID: 28787619
You can check HttpContext.Current. If it is null the method is not being called from a web environment.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question