473,327 Members | 2,055 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,327 software developers and data experts.

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 1171
Nikolay,

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

Sub New (byval MyForm as Windows.Forms.Form)
'for windows forms
Sub New (byval myPage as System.Web.Ui.Page)
'for webforms
Sub New
'for others

I hope this helps,

Cor
"Nikolay Petrov" <jo******@mail.bg> schreef in bericht
news:11*********************@o13g2000cwo.googlegro ups.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*********************@o13g2000cwo.googlegro ups.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.GetEntryAssembly'
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, 'GetEntryAssembly' returns nothing and
'GetCallingAssembly' 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
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...
5
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...
4
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...
5
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...
1
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...
4
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...
0
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...
5
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...
23
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.