473,505 Members | 13,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine if WebApp was Launched from Visual Studio

Hi all.

I've got some code I've placed in my global.asax file that registers a
trace listener. The listener actually makes Debug.Assert statements
that fail break into the debugger, which is quite handy for me.
However, if the user didn't launch the application from Visual Studio,
the listener wreaks havoc with their browser (lots of nefarious
JavaScript errors).

The code I've included in global.asax looks like this:

----------------------------------------------------------------------
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)

Debug.Listeners.Add(New AspNetAssertListener)

End Sub
----------------------------------------------------------------------

Now, what I'd LIKE to do is add the listener only IF the web
application was launched from the IDE. Something like this:

----------------------------------------------------------------------
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)

If InIDE() Then
Debug.Listeners.Add(New AspNetAssertListener)
End If

End Sub
----------------------------------------------------------------------

Does anyone know if there's a way to determine whether or not the
application has been launched from the IDE?

Thanks!

Nov 19 '05 #1
2 1179
Tyrant Mikey wrote:
Hi all.

I've got some code I've placed in my global.asax file that registers a
trace listener. The listener actually makes Debug.Assert statements
that fail break into the debugger, which is quite handy for me.
However, if the user didn't launch the application from Visual Studio,
the listener wreaks havoc with their browser (lots of nefarious
JavaScript errors).

The code I've included in global.asax looks like this:

----------------------------------------------------------------------
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)

Debug.Listeners.Add(New AspNetAssertListener)

End Sub
----------------------------------------------------------------------

Now, what I'd LIKE to do is add the listener only IF the web
application was launched from the IDE. Something like this:

----------------------------------------------------------------------
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)

If InIDE() Then
Debug.Listeners.Add(New AspNetAssertListener)
End If

End Sub
----------------------------------------------------------------------

Does anyone know if there's a way to determine whether or not the
application has been launched from the IDE?

Thanks!


One thing you could try to do is wrap the code in
#if DEBUG
#endif
commands. If you recompile in "Release" mode (as for a "live" site)
this code is not included.

Hans Kesting
Nov 19 '05 #2
I considered that, but the problem is that there's plenty of code in
#IF DEBUG...#ENDIF blocks elsewhere in the program that I *want* to
execute in the test environment.

I suppose I could define another constant, and use that.

Nov 19 '05 #3

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

Similar topics

18
2849
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
0
956
by: Thomas | last post by:
I`m developing a three-tier webapplication using stored procedures as my method for accessing my database. In Visual Studio I have a web project, a business logic project and a data-access project,...
3
1501
by: peter | last post by:
When I try to create a new ASP.NET webapplication (in Visual Studio 2003) or try to open an existing one, I get the following error-message : 'The webserver reported the following error when...
8
1364
by: Victor Hadianto | last post by:
Hi, Everytime I change my code and hit the start debug button on the ASP.Net WebApp project I often get a very annoying message saying such and such dll is missing from ASP.Net temporary...
1
1110
by: Roland Riess | last post by:
Hi, as I tried a lot of hints from the newsgroups archives - all without success - I hope that somebody can help me here. I am using Windows 2000, VS 2003 and a local IIS 5.0. Up to now I...
2
1715
by: Ing. Davide Piras | last post by:
Hi there, we have a big web application wrote in Visual Studio .NET 2003 (Framework 1.1) which we still use to modify, evolve and compile all the assemblies... on IIS we are trying to set the...
1
1539
by: redjoy | last post by:
I have a Visual Studio 2003 solution with multiple projects (3 C++, 2 C#, and 2 VB). The code has been maintained and upgraded since VC 6.0 by several developers. There are litarally several hundred...
2
1933
by: Microsoft Newsserver | last post by:
Hi, we have a progress bar which is revealsed before the postback occurs. basically, we add an onclick attribute to the submit button which reveals the progress.gif. This has the effect of...
3
1165
by: mr t | last post by:
Sometimes ago, when I added a webreference, visual studio created a Reference.vb proxy class. In vs.net 2005, I don't see it. instead it adds .disco, .discomap, .wsdl. when I try to run the web...
0
7213
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
7298
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.