How to create a very long url link without putting everything on one line

Posted on 2009-02-18
Last Modified: 2012-05-06
<a href="">CLICK</A>

filename.xml is another file with all the xml tags.

but i don't know to how to attatch a separate file in a hyperlink..

Question by:Ricky11
    LVL 28

    Expert Comment

    The length of a querystring is limted, it depends on the browser, but I remember it was something like 2,000 characters max.

    That having said, it you want to have the xml as text in a querystring, you probably need to urlencode(escape) it.

    sLink = ""
    sLink =  = sLink & "xml=" & Escape(xmlstring)

    Open in new window

    LVL 28

    Expert Comment

    There was an "=" too much in the code above.
    sLink = ""
    sLink = sLink & "xml=" & Escape(xmlstring)

    Open in new window


    Author Comment

    Thanks, actually what i would like to do is insert a file name that has the xml code, is that possible?

    like :

    filename = "c:\test.xml"

    then <a href=xxxxx.asp?xml=<%filename%>

    so that it loads the content of the xml file into the url.

    LVL 28

    Accepted Solution

    Not in the way you want, you need to write function that gets the content of the file, see code below

    And I warned you that very long urls are problematic.

    filename = "c:\test.xml"
    <a href=xxxxx.asp?xml=<%=Escape(ReadTextFile(filename))%>
    Function ReadTextFile(ByVal s)
        Dim oFS, oFile, oTextStream
        Set oFS = Server.CreateObject("Scripting.FileSystemObject")
        If Not oFS.FileExists(s) Then Exit Function
        Set oFile = oFS.GetFile(s)
        If oFile.Size > 0 Then
            Set oTextStream = oFS.OpenTextFile(s)
            ReadTextFile = oTextStream.ReadAll
            oTextStream.Close: Set oTextStream = Nothing
        End If
        Set oFile = Nothing: Set oFS = Nothing
    End Function

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now