How to change the absolute to the Relative path in ASP.Net with XHTTP
Please note that to change the absolute path to the relative path via the ASP.Net code with the help of XHTTP Component and this code is in VB Script. First you have to add the library function of the XHTTP in the ‘aspx.vb’ file of the page via below mentioned line.
Imports XHTTP
Now, in the coding part of that page first you have to declare the variables that requires for the changes.
Variable Declaration
Dim Domname,link,str,temp as string
‘Final Code
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 is chage the all the absolute path of a tag into the relative path of the site Domain.Com.
(Posted By Shane on Sunday, June 18, 2006)
Read All Stories
|
|
|
|