473,385 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Programmatically determining WinForm or ASP.NET

I am developing a class which will be used in both a WinForm and ASP.NET 2.0
application. The class needs to know which type of application it is running
in. How do you programmatically determine what type of application (WinForm
or ASP.NET) you are currently running in? I have looked at
Environment.UserInteractive but this will not have the right effect when
debugging an ASP.NET application.

Thanks,
Larry
Jan 20 '06 #1
3 1581
You can check the System.Web.HttpContext.Current property for null. If
the return is null then it is executing out of the ASP.Net pipeline, if
it returns a valid HttpContext class then its running from withing the
ASP.Net pipleline.

Hope this helps...
- NuTcAsE

Jan 20 '06 #2
if ASP.NET is hosted on the IIS, you can check process name from within your
class.
IIS has predefied process names

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Larry Hunt" <la********@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
I am developing a class which will be used in both a WinForm and ASP.NET
2.0 application. The class needs to know which type of application it is
running in. How do you programmatically determine what type of application
(WinForm or ASP.NET) you are currently running in? I have looked at
Environment.UserInteractive but this will not have the right effect when
debugging an ASP.NET application.

Thanks,
Larry

Jan 20 '06 #3
Hi NuTcAsE,

This works great! Thanks!!!

Larry

"NuTcAsE" <ra********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
You can check the System.Web.HttpContext.Current property for null. If
the return is null then it is executing out of the ASP.Net pipeline, if
it returns a valid HttpContext class then its running from withing the
ASP.Net pipleline.

Hope this helps...
- NuTcAsE

Jan 20 '06 #4

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

Similar topics

9
by: Marek Mand | last post by:
How to use generated keyboard events? What I am trying here to do is in onkeyup event handler http://www.hot.ee/idaliiga/braggart/createEventTest.htm generate a (shift)TAB keydown so the...
2
by: Donna Lenharth | last post by:
Is there a way to determine the fixpack level of a V8 client and server programmatically? I'm aware of the db2level command, but only want to use that as a last resort. Thanks in advance for...
8
by: vadim | last post by:
Hi, Is there a .Net control available that allows to write into web.config file appsettings section? The idea is to create encrypted user name and password for database connection and then...
6
by: Pierre | last post by:
Hi all, I'm building a small app that allows users to create proxys by clicking on an interface (web, winform). I started my project, imported wsdl.exe (add reference) and tried to figure out...
0
by: Ginger Estherskip | last post by:
How do you programmatically start moving a SDI winform? Here's the issue: I've got a form as part of a tabbed MDI set, and I wrote it so that a user can "tear" the form off of the MDI by...
0
by: JLC | last post by:
Hi, I am working on a WinForm in C# and when the app loads it checks the user who is logged in and based on that user I want to have two sizes of the same form. First size is short and has two...
1
by: Bruno43 | last post by:
How could I programmatically add multiple text boxes to a WinForm, in Visual Basic 2005 Basically I want to read a table in a database and depending on how many rows there are I would like to add...
3
by: John | last post by:
Hi I am trying to manipulation asp.net membership programmatically from a winform app. I have added the connectionstring and membership & role setting fragment to my app's app.config file as per...
11
by: =?Utf-8?B?UGV0ZXIgSw==?= | last post by:
I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.