Upgrading VB6 cgi-bin routines to VB.NET

G

Guest

Hi

I want to update some CGI-BIN routines driven from <b>Classic</b> ASP that I wrote in VB6. There are a number of criteria controlling what I'm doing:

1. I don't want to rewrite the Classic ASP pages in ASP.NET just yet
2. I can make changes to the Classic ASP pages but don't want to go crazy
3. Although I'm reading STDIN with my VB app, I don't mind using other methods

There seem to be two ways of going about this (and I'm happy to be corrected here):

1. A mechanism to reference a .NET assembly (of a console application), somehow collect the command line arguments and then process them. This is pretty much what the existing VB6 application does - the form data is POSTed directly to the EXE file.

2. Instantiate a .NET DLL (with something akin to Server.CreateObject) and pass it the Request.Form contents. This would have the advantage that form data validation could be dealt with using conventional ASP techniques prior to the data being despatched to the web server. This begs the question (amongst others) as to how to let ASP know where the .NET DLL resides since you can't register it in the usual way like a COM object.

Thanks in advance

Crispin
Bristol, UK.
 
C

Cor

Hi Crispin,

You can use Visual.Studio.Net or a seperate compiler.

They both use a ASPX.VB (or CS) page.
That ASPX.VB(CS) file can be compiled or just stay in the directory and
everytime just in time be compiled as the user ask for the page.

The ASPX.VB is not compiled as an single page DLL but with more pages
together in one asp net applications DLL.

I try to give you some ideas, but ask this question also in the newsgroup

micosoft.public.dotnet.framework.aspnet

There are more people active who can give you advice and than you get a
wider view on it.
(Althouhg some of them are also active in this newsgroup)

I hope this helps a little bit?

Cor



I want to update some CGI-BIN routines driven from <b>Classic</b> ASP that
I wrote in VB6. There are a number of criteria controlling what I'm doing:
1. I don't want to rewrite the Classic ASP pages in ASP.NET just yet
2. I can make changes to the Classic ASP pages but don't want to go crazy
3. Although I'm reading STDIN with my VB app, I don't mind using other methods

There seem to be two ways of going about this (and I'm happy to be corrected here):

1. A mechanism to reference a .NET assembly (of a console application),
somehow collect the command line arguments and then process them. This is
pretty much what the existing VB6 application does - the form data is POSTed
directly to the EXE file.
2. Instantiate a .NET DLL (with something akin to Server.CreateObject) and
pass it the Request.Form contents. This would have the advantage that form
data validation could be dealt with using conventional ASP techniques prior
to the data being despatched to the web server. This begs the question
(amongst others) as to how to let ASP know where the .NET DLL resides since
you can't register it in the usual way like a COM object.
 
T

Tian Min Huang

Hello Crispin,

Thanks for your post. As I understand, you want to create VB .NET cgi-bin
routines. Please correct me if there is any misunderstanding. I now share
the following information with you:

1. A Common Gateway Interface (CGI) application can be written in any
programming language that can access both the environment variables and
STDIN or STDOUT. I recommend you the following article on "CGI Programming
in C#", there is not much functionality difference between VB .NET and C#
in .NET.

CGI Programming In C#
http://www.c-sharpcorner.com/WebForms/CGIPorgrammingInCSKS002.asp

2. If you want to access a .NET Class Library from native program, you
should use COM Interop:

COM Interop Sample: COM Client and .NET Server
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcominteropsamplecomclientnetserver.asp

COM Interoperability in Visual Basic and Visual C#
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbconcominteropinvisualbasicvisualc.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.
 
G

Guest

Tia

Thanks for your reply. I'd come across the article on GGI Programming in C# on another website (it's obviously doing the rounds). But there's no mention there about how to deal with the command line arguments. What I've now done is revert to the VB6 application and redraft it to meet my new requirements and that seems to work. It's not pretty, but I'm short of time

As I was doing the research into this, the weaknesses of the CGI-BIN approach became apparent, so I'll treat this as an interim solution and get on with learning ASP.NET as quickly as I can.

Crispin
 
T

Tian Min Huang

Hello Crispin,

Thanks for your feedback. In .NET application, we are able to get command
line arguments from the Environment.CommandLine property, please refer to
the MSDN document:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemenvironmentclasscommandlinetopic.asp?frame=true

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

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.
 

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

Top