Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

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

<a href="https://secure.shippingapis.com/ShippingAPI.dll?api=OpenDistributePriority&xml=filename.xml">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..

Thanks.
0
Ricky11
Asked:
Ricky11
  • 3
1 Solution
 
sybeCommented:
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 = "https://secure.shippingapis.com/ShippingAPI.dll?api=OpenDistributePriority&"
sLink =  = sLink & "xml=" & Escape(xmlstring)

Open in new window

0
 
sybeCommented:
There was an "=" too much in the code above.
sLink = "https://secure.shippingapis.com/ShippingAPI.dll?api=OpenDistributePriority&"
sLink = sLink & "xml=" & Escape(xmlstring)

Open in new window

0
 
Ricky11Author Commented:
Hello
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.

tks.
0
 
sybeCommented:
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

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now