Possibly strange question regarding VB.NET and CGI

N

Nak

Hi there,

Im currently developing a web site using PHP. Unfortunately due to
limitations with my web server I am having to use XML as a method of data
persitance, this doesn't really bother me as I prefer XML anyway. I'm not
using ASP.NET for design reasons at the moment.

At the moment I am fighting a design battle in relation to file writing
and various locking methods which all appear to be very unreliable. That's
why I am looking into CGI. Now apparently any application can use CGI as
long as it implements a specific interface (though what this is I haven't
quite worked out yet). So I'm just wondering if it is at all possible to
use VB.NET with CGI?

Writing some code to perform XML work with VB.NET will be a piece of
cake obviously and probably the main reason why I should be using ASP.NET
anyway, but for now I am looking into alternatives. Has anyone known this
to be done? I've seen examples of it one in legacy VB via stdio stream
handling, so it must be possible with VB.NET right?

Anyway, any thoughts on this would be greatly appreciated. Thanks loads
in advance!

Nick.
 
T

Tom Shelton

Hi there,

Im currently developing a web site using PHP. Unfortunately due to
limitations with my web server I am having to use XML as a method of data
persitance, this doesn't really bother me as I prefer XML anyway. I'm not
using ASP.NET for design reasons at the moment.

At the moment I am fighting a design battle in relation to file writing
and various locking methods which all appear to be very unreliable. That's
why I am looking into CGI. Now apparently any application can use CGI as
long as it implements a specific interface (though what this is I haven't
quite worked out yet). So I'm just wondering if it is at all possible to
use VB.NET with CGI?

Writing some code to perform XML work with VB.NET will be a piece of
cake obviously and probably the main reason why I should be using ASP.NET
anyway, but for now I am looking into alternatives. Has anyone known this
to be done? I've seen examples of it one in legacy VB via stdio stream
handling, so it must be possible with VB.NET right?

Anyway, any thoughts on this would be greatly appreciated. Thanks loads
in advance!

Nick.

Yes it's possible. Basically, you would just create your CGI
application as a Console app. I won't go into the details of CGI here -
but essentially, all a language has to be able to do is read environment
variables and handle stdin and stdout. So, your good here :) The place
where you may have difficulty (at least I did when I played with this
year or so ago) is getting the permissions right so that your
application will run.
 
C

Cor Ligthert

Nick,

When you have this Javascript you are in my opinion be halfway.
The XML file I use is a true XML dataset

\\\
var fotosXML = new ActiveXObject("Msxml2.DOMDocument");
xmlinlopen(fotosXML, 'fotos');
function xmlinlopen(object, bestand){
object.async = false;
object.resolveExternals = false;
object.load(bestand + ".xml");
xmlinlopena(object);}
//in my opinion should this beneath be there accoording the documentation,
however
//I think that it does nothing (this is not a copied script by the way but
own made)
function xmlinlopena(object) {
if (object.readyState < 3 ) window.setTimeout('xmlinlopena(object)',100);}
///

Than when you have to use it, you can look at MSDN for "selectNodes"

The rest of the code I have made is so generic that it is senseless to show
to you.
"inlopen" is something as "load" and bestand is "file", I did not change it
to prevent typing errors.

I hope this helps?

Cor
 
N

Nak

Hi Cor,
When you have this Javascript you are in my opinion be halfway.
The XML file I use is a true XML dataset

Aaah, I think I may have not explained my problem properly. Handling
XML in PHP is very simple, I like it, much less code than most languages to
be honest with you, I even have XPath navigation.

My problem is 2 clients accessing the PHP script at the same time, this
could cause grief with file access causing a violation or only 1 change to
be made. I'm using XML for my hit and download counters.

That's why I would like to make a VB.NET CGI app that can run
asynchronously and que up write requests. I'm hoping this can be achieved
although I may need to use C.

Thanks for the JAVA code though, I'll keep a snipette of that, quite
handy.

Nick.
 
N

Nak

Hi Tom,
Yes it's possible. Basically, you would just create your CGI
application as a Console app. I won't go into the details of CGI here -
but essentially, all a language has to be able to do is read environment
variables and handle stdin and stdout. So, your good here :) The place
where you may have difficulty (at least I did when I played with this
year or so ago) is getting the permissions right so that your
application will run.

Aah, thats good to know, although the last bit worries me. My website
is hosted by a 3rd party so I doubt I can get them to apply permissions like
that, although I *might* be wrong. Thanks for the input at least I have a
solid yes/no answer now :) Cheers.

Nick.
 
N

Nak

Hi,

Just incase anyone else wants to use VB.NET to create a CGI binary
executable, you can use the following PHP class to run it,

<?php

class application
{
var $filename;

function application($ifilename)
{
$this->filename = "<replace this for your CGI bin path>" . $ifilename;
}

function execute($iarguments)
{
$cmd = $this->filename;
$outputfile = tempnam("<replace this for your temp path>", 'appout');
$cmdline = "cmd /C " . $cmd . " " . $iarguments . " > " . $outputfile;
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmdline, 0, true);
readfile($outputfile);
unlink($outputfile);
}

}

?>

Then to call it,

<?php

// Include the PHP script with the application class in here
$app = new application("helloworld.exe");
$app->execute("<put any arguments in here>");

?>

VB.NET doesn't seem that bad for CGI applications either, especially
with the benefit of the .NET Frameworks XML functions you can create far
more powerful objects than you could in PHP. Anyway, I hope this helps
someone else because it took me fekking ages working this out!

Nick.
 
C

Cor Ligthert

Nick

I cannot use it at the moment, however you never know tomorrow

Did I ever told you that my VBNet snippet directory has the name Nak.
However this one I leave in this newsgroup, I can find it probably in Google
using Nak and PHP.

:)

Thanks,

Cor
 
N

Nak

Hi Cor,
I cannot use it at the moment, however you never know tomorrow

LOL, I hate web development, hence my attempt to use VB.NET as much as
possible.
Did I ever told you that my VBNet snippet directory has the name Nak.
However this one I leave in this newsgroup, I can find it probably in
Google using Nak and PHP.

Haha, yeah, not much call for this kind of thing, but it took me so long
to work out that I had to share it. I'll have a web site set up soon
hopefully with loads of other crap code snipettes ;-)

Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top