473,804 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to distinguish WinForms from ASP .NET?

I have compiled some shared function in a lybrary, which I use in
various application from asp pages, web services to winforms and
windows services.

some of the functionality in my libarary is dependent on where it is
called from. I would like to do one things if it is called from asp
application, and other if it is called from WinForms app.

Is there a way, I can distinguish where me library functions are called
from?

Nov 21 '05 #1
7 1185
Nikolay,

Just as idea, create your sub news like that and pass the form or whatever

Sub New (byval MyForm as Windows.Forms.F orm)
'for windows forms
Sub New (byval myPage as System.Web.Ui.P age)
'for webforms
Sub New
'for others

I hope this helps,

Cor
"Nikolay Petrov" <jo******@mail. bg> schreef in bericht
news:11******** *************@o 13g2000cwo.goog legroups.com...
I have compiled some shared function in a lybrary, which I use in
various application from asp pages, web services to winforms and
windows services.

some of the functionality in my libarary is dependent on where it is
called from. I would like to do one things if it is called from asp
application, and other if it is called from WinForms app.

Is there a way, I can distinguish where me library functions are called
from?

Nov 21 '05 #2
too much of overhead
i have hundreds of subs/functions, classes and so on
isn't there a way to know where a procedure is called from, an asp or
winforms?

Nov 21 '05 #3
How about testing for the presence of HTTPContext? If there's no HTTP
Context, chances are pretty good it's a WinForm app. You could set this to
a property to easily retrieve it in your solution.

"Nikolay Petrov" <jo******@mail. bg> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
I have compiled some shared function in a lybrary, which I use in
various application from asp pages, web services to winforms and
windows services.

some of the functionality in my libarary is dependent on where it is
called from. I would like to do one things if it is called from asp
application, and other if it is called from WinForms app.

Is there a way, I can distinguish where me library functions are called
from?

Nov 21 '05 #4
"Nikolay Petrov" <jo******@mail. bg> schrieb:
I have compiled some shared function in a lybrary, which I use in
various application from asp pages, web services to winforms and
windows services.

some of the functionality in my libarary is dependent on where it is
called from. I would like to do one things if it is called from asp
application, and other if it is called from WinForms app.

Is there a way, I can distinguish where me library functions are called
from?


I have never tested it, but I am curious what 'Assembly.GetEn tryAssembly'
returns for ASP.NET applications.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
worth trying Herfried

Nov 21 '05 #6
"Nikolay Petrov" <jo******@mail. bg> schrieb:
worth trying Herfried


For a simple ASP.NET page, 'GetEntryAssemb ly' returns nothing and
'GetCallingAsse mbly' returns "System.Web ...".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
thanks Herfried

Nov 21 '05 #8

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

Similar topics

0
1444
by: Alan Partridge | last post by:
I have an app with both a webforms and winforms front end. When I change the web.config file, eventually IIS\ASP.NET pick up the changes and all is well. With the WinForms GUI - when I change the .config file, I need a way to force the AppDomain to reload the new config settings. This doesn't need to be automatic cause I can control when the config file is updated. Does anyone know how to force a reload of a new config
5
9756
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Attributes |
4
3739
by: Elhanan | last post by:
hi.. all a client of ours is considering to move from a dos application to windows desktop application. the application is for traveling agency, the database is rather large. their current database for other application is SQL-SERVER. they have 12 users.
5
4100
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names The DLL's have been copied to the /bin directory in both web virtual directories.
1
8559
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote Me.ReportViewer1.ServerReport.ReportPath = "/myproject/DemandeDeCotation" Me.ReportViewer1.ServerReport.ReportServerUrl = New System.Uri("http://myserver/reportserver2005", System.UriKind.Absolute)
4
3942
by: 3Cooks | last post by:
I have a windows application written in Visual Basic 6.0 that is going to be redeveloped in dotNET. We are trying to decide if we should deploy using Webforms or Winforms and I need advice from someone who is not on my team. The VB 6.0 application is used by approximately 100 users. All users reside in-house. There is an existing external website that will use some of the same components but the two applications are separate. The...
0
1657
by: netflex | last post by:
Working on a handed off C# project and pretty much my third time dipping into C#. In my solution file, I have a collection of .resx files in their own folder, several .cs files, and my winforms .cs files. From what I understand the .resx files house embedded resources, such as images and buttons texts. When I open up my winforms however there is nothing there! When I open up my winforms code behind, I see code such as: this.$ = new...
5
3831
by: brian.wilson4 | last post by:
Our group is currently comparing winforms vs webforms.....app is Corp LAN based - we have control of desktops.....Below is pros and cons list we have come up with - if anything strikes you as untrue or you would like to add - please comment - thanks..... Rich Client PROS 1. User experience (* indicates feasible on web with AJAX) - a. Single, unified application experience b. Windows/Office-like look and feel - i.Tabs - drag and drop...
23
4575
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I memorize and/ or familiarize myself in WinForms will disappear in WPF? I did note in one early version of C#, the non-generic "ArrayList" was replaced by the generic and template <based List, but that kind of change is not a big deal. If WPF...
0
9714
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
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
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...
1
10347
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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...
0
9173
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6863
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
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
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 we have to send another system

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.