PDA

Click to See Complete Forum and Search --> : Using Server.URL in a VB Program


Aug 3rd, 2000, 07:18 AM
How do I use the Server.URLEncode method (in the ASP Type Library) in a normal VB program?

I know I've got it on my machine (I've got PWS installed which uses it) and I've added it to my project's references.

Basically I want to use a line of code like:
sTemp = Server.URLEncode(txtMessage)


I'm using this sotra code to set it up:
Dim objURLFix As Server
Set objURLFix = CreateObject("Server")
But I can't get it to work... I either get an error about ActiveX not being able to create the (Server) object, or object variable or with block not set.

So come on guys...what's the correct syntax to declare the server object?

compuGEEK
Aug 4th, 2000, 03:40 PM
This is the way to create a server object:


dim objURLFix

set objURLFix = server.CreateObject("TypeOfObjectToCreate")



However, I think you can use


server.urlEncode("String")



without creating an instance of it first.


[Edited by compuGEEK on 08-04-2000 at 05:10 PM]

Aug 5th, 2000, 05:20 AM
No, that's not what I mean. You've described how to create ActiveX objects in an ASP page. I can do that. That's fine.

I'm not using ASP here tho. I'm in proper VB, but I want to use the "Server.URLEncode" method in the ASP Type Library.

I'm creating a standalone exe program that submits information to a cgi script on a website.

I want to use the Server.URLEncode method to make sure there are no illegal characters in the in the querystring I send to the script.

So basically I'm trying to create an instance of the Server object in a proper VB program.

compuGEEK
Aug 7th, 2000, 10:06 AM
Oh...I see. Sorry!

DavidBG
Nov 20th, 2000, 08:20 AM
I am not really sure..
But I think you should reference the Microsoft Active Server page Object in VB at Menu item PROJECT/REFERENCES
and check on MICROSOFT ACTIVE SERVER PAGE OBJECT LIBRARY.

After referenceing the ASP object Lib...you can then use the server object..like
Server.CreateObject(".....") etc.

If it works something for you, I would like to hear about it.




[Edited by DavidBG on 11-21-2000 at 10:15 AM]