473,657 Members | 2,490 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_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)

Debug.Listeners .Add(New AspNetAssertLis tener)

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_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)

If InIDE() Then
Debug.Listeners .Add(New AspNetAssertLis tener)
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 1183
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_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)

Debug.Listeners .Add(New AspNetAssertLis tener)

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_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)

If InIDE() Then
Debug.Listeners .Add(New AspNetAssertLis tener)
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
2877
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 that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the originator) and e (event arguments). I know how to get typeof (sender) to determine what form or...
0
961
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, each resulting in its own dll. Now lets say I wantet to update my data-access layer to use standard ansi sql queries. Is there a way of implementing this architecture that allows my to update only a single .dll on a client server without the...
3
1507
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 attempting to create or open the Web project located at the following URL 'http://localhost/WebApplication01 Unable to connect to the server'. But I know IIS is running, because I can start an existing
8
1370
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 directory. This is really strange it seems that there is a problem with Visual Studio.Net compiler because to fix this I had to stop the webserver, recompile (VS.Net rebuild), restart IIS and then start debugging.
1
1111
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 programmed WinForms only but now I shall create a web application. And there I suddenly faced the problem the I cannot even create a new web app project in Visual Studio as the following error occurs:
2
1724
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 .NET Framework version to 2.0 for runtime (we've read that we can get up to 30% of performance increase, is it true???), the problem is that we cannot debug with Visual Studio.NET 2003, we get error at the launch of the web app... in the same...
1
1548
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 files in the solution (the majority in the C++ projects.) I want to find out what files are REALLY used by the C++ projects. I know that the project file has a list of all files included in the specific project but I also know that I do not need...
2
1937
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 showing progress while we are waiting for the back to come page from the server. Now, when we lanch the application from within visual studio this works fine, when deployed however, either locally on IIS or remotely on IIS, the anigif freezes on...
3
1172
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 app, it attemps to write to the c:\windows\temp directory. I hate that approach. because I DO not want to give IIS the permissions to write to windows temp directory due to potential security problems. there might be other process writing to that...
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.