Solved

How to using server.URLEncode at visual basic 6.0

Posted on 2001-06-02
9
1,370 Views
Last Modified: 2013-11-25
hi
How to using server.URLEncode at visual basic 6.0

thank
0
Comment
Question by:kwq5421
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 6

Expert Comment

by:sharmon
ID: 6149952
If you are making a IIS application it should already be available to you.  If not you may want to look at this function that someone has already written, that will do it for you.  Here is the link...

http://www.planet-source-code.com/xq/ASP/txtCodeId.3229/lngWId.1/qx/vb/scripts/ShowCode.htm
0
 
LVL 1

Author Comment

by:kwq5421
ID: 6150037
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
 
LVL 1

Author Comment

by:kwq5421
ID: 6150051
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:kwq5421
ID: 6150093
Can i using the vbscript server.urlencode at vb source code ? thank ..
0
 
LVL 1

Expert Comment

by:jdunck
ID: 6150741
Server.URLEncode is not part of VBScript.

The Server object is part of ASP...-not- part of VB.

Understand that methods of objects are part of that object, -not- part of the language you happen to be programming in.

ASP can be written in JavaScript just as easily, and COM objects can be used by any language that supports COM (C++, VC++, VB, Java, I think).
0
 
LVL 6

Accepted Solution

by:
sharmon earned 15 total points
ID: 6150895
Add a reference to Microsoft ASP library in your project and it will expose Server, Session, etc...but they will not work unless they are passed from a real Session on a IIS server into your project.  You cannot set them to new objects.  I do not know the reasoning behind it as I have never looked into it.  I haven't ever had a need to use the ASP object library without a IIS Server.  
0
 
LVL 6

Expert Comment

by:andyclap
ID: 6151907
It's not actually a very difficult function, you could write your own along the lines of:

Public Function URLEncode(ByVal s As String) As String

    Dim lLoop As Long
    Dim sC As String

    URLEncode = ""
    For lLoop = 1 To Len(s)
        sC = Mid$(s, lLoop, 1)
        If InStr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", UCase$(sC)) = 0 Then
            If Asc(sC) < 16 Then
                sC = "%0" & Hex$(Asc(sC))
            Else
                sC = "%" & Hex$(Asc(sC))
            End If
        End If
       
        URLEncode = URLEncode & sC
    Next
   
End Function
0
 
LVL 1

Expert Comment

by:jdunck
ID: 6152378
AndyClap --
  Its true that the specs aren't hard to handle, but since the original question was so far off the mark, I was trying to explain what he was really asking.
  Trying to use an ASP-created object as an intrinic property of VB begs for clarification.
0
 
LVL 6

Expert Comment

by:sharmon
ID: 6199533
If you didn't like the responses you had gotten from us so far, you should have requested a deletion of the question or held out for whatever you were looking for.  This is the third time someone I responded who couldn't do what they were asking for and I told them that, and gotten a grade of C for it.  I would have rather not helped you at all.  I don't think I'll be responding to questions that do not have a valid answer anymore.  There were two answers to this, one You Cant Include the ASP Object Library in a VB Stand Alone Application, or write your own replacement function.  You have gotten both of them from me, and another from Andy.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question