473,624 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

programmaticall y access a web app via a windows service

Hi,

I need a general direction. I don't even know where to start
researching how to do this.

I have an existing dot net web application (It's mine, I wrote it)
that has some text fields and a button. The code-behind click event
of the button sends an SNPP conversation to a pager server.

I also have an existing dot net windows service running on a dedicated
machine with special hardware that can listen for and receive the
pages via radio. The purpose of the service is to monitor various
paging applications. It does so by continuously looping through a set
of test pages and listens for them to return.

My client now wants me to "monitor" the web application. I need to
have the windows service execute the web application and send a page
as if a human had done so. I have no idea how to proceed.

Is there an obvious definitive way of doing this that I am
overlooking? Does anyone have any creative ideas? If Microsoft is
monitoring this, do you have any suggestions?

Thanks in advance,
Doug
Jul 21 '05 #1
8 5852
Hi Doug,

Thanks for your post. .NET Class Library provides several classes (say,
System.Net.Http WebRequest) which can be used to access web pages. I believe
the following MSDN article and sample are helpful:

HttpWebRequest Class
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemneth ttpwebrequestcl asstopic.asp

SAMPLE: Visual C# .NET Networking Classes HTTP Internet Client
http://support.microsoft.com/?id=303436

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hi Tian Min Huang,

Thanks for the response. I have investigated HttpWebRequest and
HttpWebResponse but these won't let me put text in a textbox and push
a button. I can simulate that activity and send a post to the server
as if a button click caused a postback, but to do that in Dot Net, I'd
have to correctly populate that hidden field with the encoded state
data. I don't expect that to be very do-able.

I seem to be having the most luck with the interop
SHDocVw.Interne tExplorer. I was hoping, however, that there would be
a way to do this in managed code.

Have I missed anything? Is this my only option?

Thanks,
Doug
ti******@online .microsoft.com (Tian Min Huang) wrote in message news:<eP******* *******@cpmsftn gxa06.phx.gbl>. ..
Hi Doug,

Thanks for your post. .NET Class Library provides several classes (say,
System.Net.Http WebRequest) which can be used to access web pages. I believe
the following MSDN article and sample are helpful:

HttpWebRequest Class
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemneth ttpwebrequestcl asstopic.asp

SAMPLE: Visual C# .NET Networking Classes HTTP Internet Client
http://support.microsoft.com/?id=303436

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Hi Doug,

Thanks for your update. The following KB article describes using Web
Browser control in .NET, please check it on your side. After loading a web
page in the control, then you can send keyboard messages to simulate a user
input and operation.

Web Browser in C# and VB.NET
http://www.c-sharpcorner.com/Interne...serInCSMDB.asp

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
Hi Tian Min Huang,

Thanks for the link. It was very informative. I have, however,
looked into this and, unless I'm missing something, it won't work in
this case.

Since this has got to work in a Windows Service it must be completely
free of any UI. In a proof-of-concept windows application, I was able
to use it as a control just fine, but when I tried to simply
instantiate it as an object it complained. It seems to really want to
write to something and I couldn't placate it.

I was able to instantiate an instance of the InternetExplore r class in
the same DLL and it seemed happy not having a UI available. I am
worried about using this object for two reasons.

First, this seems like a pretty bulky object to leave lying around or
to be constantly creating and destroying.

Second, this Windows Service must continue looping 24/7 for months at
a time. Is this object "leak proof"?

Thanks again,
Doug
ti******@online .microsoft.com (Tian Min Huang) wrote in message news:<46******* *******@cpmsftn gxa06.phx.gbl>. ..
Hi Doug,

Thanks for your update. The following KB article describes using Web
Browser control in .NET, please check it on your side. After loading a web
page in the control, then you can send keyboard messages to simulate a user
input and operation.

Web Browser in C# and VB.NET
http://www.c-sharpcorner.com/Interne...serInCSMDB.asp

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
Hi Doug,

Thanks for your response. I'd like to share the following information with
you:

1. Generally speaking, a Windows Service is desinged to be running
background without UI. Still, we are able to create a visible/hidden form
within Service as long as running the windows service in Local System
account, allowing service to interact with desktop.

2. I am glad to hear that you were able to automate Internet Explorer (by
instantiating an instance of the IE class). That is, you start Internet
Explorer from within your service. I believe this is a good method and
there is no need to worry about the issues like "IE is leak proof".

I look forward to your feedback.

Have a great day!
Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #6
Hi Tian Min Huang,

Sorry for the delay. I seem to have had a setback. the solution
using the InternetExplore r object works perfectly in a Windows
application and a console application (which is where I developed it),
but when I put it in my Windows service, it stops functioning.

I can call the "navigate" method without incurring an error, but the
object never fires any of its events unlike in the other environments.

I still can't help feeling that the problem is that the IE object
contains forms (visible or not) which are forbidden in a Windows
service.

Any more thoughts?

Thanks,
Doug

ti******@online .microsoft.com (Tian Min Huang) wrote in message news:<8N******* *******@cpmsftn gxa06.phx.gbl>. ..
Hi Doug,

Thanks for your response. I'd like to share the following information with
you:

1. Generally speaking, a Windows Service is desinged to be running
background without UI. Still, we are able to create a visible/hidden form
within Service as long as running the windows service in Local System
account, allowing service to interact with desktop.

2. I am glad to hear that you were able to automate Internet Explorer (by
instantiating an instance of the IE class). That is, you start Internet
Explorer from within your service. I believe this is a good method and
there is no need to worry about the issues like "IE is leak proof".

I look forward to your feedback.

Have a great day!
Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #7
Hi Doug,

Thanks for your resposne.

As you know, the desktops of the interactive window station, Winsta0, can
be made to display a user interface and receive user input, but only one of
these desktops at a time is active. As you know, a service will be created
in the non-interactive window station by default, I believe that's the
cause of this problem. I recommend you configure your service as
interactive service by running the windows service in Local System account
and allowing service to interact with desktop, and then check whether or
not the problem still exists. Please refer to the following MSDN article
for detailed information:

Interactive Services
http://msdn.microsoft.com/library/de...us/dllproc/bas
e/interactive_ser vices.asp

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #8
ti******@online .microsoft.com (Tian Min Huang) wrote in message news:<8N******* *******@cpmsftn gxa06.phx.gbl>. ..
Hi Doug,

Thanks for your response. I'd like to share the following information with
you:

1. Generally speaking, a Windows Service is desinged to be running
background without UI. Still, we are able to create a visible/hidden form
within Service as long as running the windows service in Local System
account, allowing service to interact with desktop.

2. I am glad to hear that you were able to automate Internet Explorer (by
instantiating an instance of the IE class). That is, you start Internet
Explorer from within your service. I believe this is a good method and
there is no need to worry about the issues like "IE is leak proof".

I look forward to your feedback.

Have a great day!
Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


IE webcontrol is VERY LEAKY. I have a VB test case use IE webcontorl
that continuously hit a few pages on a website. The system loose 128K of
RM every loop. A 1GB RAM system will run out memory completely in over night
test. Search Google and you will find other had asked MS for fix for this.
There is not response from MS about this at all.

--
Browse source code and document for .NET CLI, Mozilla, Apache, NetBSD at
http://www.slink-software.com?E=SLinkEvn_1004
Jul 21 '05 #9

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

Similar topics

2
2881
by: Vince Keller | last post by:
I dont know if this is the correct newsgroup to post questions on Windows Service. I am trying to install and uninstall a Windows Service programmatically. As far as I know, there isnt a class in .NET FCL which supports doing that. The ServiceController class starts/stops an installed service but doesnt install a service. Is there a way to install/uninstall a service programmatically (not using the Installer) ? Thanks.
9
7000
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under some other certian account. By further studying the code, and MSDN...
13
2564
by: Alexandra | last post by:
Hi, I have a hidden system file that I need to read. I am logged in as an administrator. I can not change the file attributes using the windows explorer.
3
9152
by: Codex Twin | last post by:
Hello apologies if this is the wrong newsgroup to be sending this to. Basically, I have an ASP.NET application that I am trying to force to use a proxy server settings. This can be done by accessing machine.config, but I do not have access to the client machine.config machine. Therefore every request made from this application must have these proxy server settings. But I am having problems writing the code for this.
8
248
by: doug.h.taylor.accipitersoftware.com | last post by:
Hi, I need a general direction. I don't even know where to start researching how to do this. I have an existing dot net web application (It's mine, I wrote it) that has some text fields and a button. The code-behind click event of the button sends an SNPP conversation to a pager server. I also have an existing dot net windows service running on a dedicated
1
1964
by: Lonewolf | last post by:
Hi, could someone please enlighten me on how I could turn on the above mentioned two windows services programmatically? Reason is i am writing a program which needs to turn on these two services in order to access the UPnP router to turn on port forwarding programmatically, and turn it off after that. Can someone please enlighten me on the functions or Win32 API to call to achieve it ? thank you so much for enlightening me on this.
7
4362
by: sunil | last post by:
Hi all, I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based on the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under NT AUTHORITY\NetworkService, so that my service can access the shared network resources.
2
2348
by: kmsultan1 | last post by:
Hello all, I need help in trying to access a web page from a windows service. I've actually already built a windows application (vb.net) that does this using the AxSHDocVw.AxWebBrowser class. The code works perfectly in the windows application, but when I use the code in a windows service, the code doesn't work! I'm assuming this is because somehow the AxWebBrowser needs a desktop context to interact with (e.g. AxWebBrowser.Navigate)....
2
3058
by: MalikTahirMahmood | last post by:
Hi, i am developing a car rental application, in which i required to get data from "salik Web site" UAE Toll system, I created one Desktop application in which i placed on webbrowser control and then programmatically login to the website and got all the required data, but since we need to collect data after every 15 mins so i want to create a windows service which can perform these tasks. So my question is How can i browse the website...
0
8168
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
8672
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
8614
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
8471
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
7153
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...
1
6107
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
5561
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
4075
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
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.