ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a web browser commends by .NET

Hi

 

I have wrote the attached code in order to control a IP Power 9258 device.

The code uses me to write a commend to the device and read his status.

the problem start as I try to use it within some other application.

If I do it all I get is that on the first run it does what it should and at the next run it doesn't do a thing.

I think the problem is coming from using the same browser refnum.

 

(see more explanations within the code) 

 

Its my first time using .NET so please be as informative as possible 🙂

 

Thanks

Shai   

0 Kudos
Message 1 of 2
(3,201 Views)

Shai,

 

the point is, there are several aspects wrong with your code. To make it short: look at the example VI I've attached - WebClient, not WebBrowser is your friend. 🙂

MOST IMPORTANT: do not create a .NET instance with every VI run! Create just one instance, do the cyclic operation, and close it again afterwards!

 

Another goodie my example shows: adding a permanently changing fake/unknown/unused parameter to the request is ignored by most servers and assures that nobody on the way (proxies etc.) will use a cached response.

 

Cheers,

Hans

 

0 Kudos
Message 2 of 2
(3,107 Views)