How To Change Absolute Path into Relative Path Using ASP.Net?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Shane
    Senior Member
    • Jun 2006
    • 264

    How To Change Absolute Path into Relative Path Using ASP.Net?

    One can use below mentioned asp.net code to change absolute path into relative path:

    Dim Domname,link,str,temp as string

    Domname = "http://Domain.com"
    ObjDoc = Server.CreateObject ("MSXML2.DOMDocument.4.0")
    objDoc.Async = False
    ObjHTTP = Server.CreateObject ("XStandard.HTTP")
    objHTTP.AddRequestHeader ("User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)")
    objHTTP.Get ("http://Domain.com")
    str = ""

    If objDoc.LoadXML (objHTTP.ResponseAsXML) Then
    For Each objNode In objDoc.SelectNodes ("//a[string (@src)!= ]")
    link = objNode.Attributes.GetNamedItem ("href").Text
    temp = link

    If InStr (link, "..") > 0 Then
    link = Mid (link, InStr(img, "/") + 1)
    End If
    Path = domname & "/"
    Path += link
    objHTTP.Get (Path
    Next
    End if

    This code will change all the absolute path of a tag into the relative path of the site Domain.Com.
    Last edited by admin; 08-21-2015, 05:00 AM.
Working...
X