di styleintimo » 06/06/05 11:07
ciao,o provato come dici tu ma mi da questo errore
Server.MapPath() error 'ASP 0172 : 80004005'
Invalid Path
/pcf_news.asp, line 63
The Path parameter for the MapPath method must be a virtual path. A physical path was used.
ti posto tutta la pagina
<%
'pc-facile.com News Version 1.2
'##################################################################
'### code by []==ThoR® for Pc-Facile ###
'## thx to Paolo ###
'##################################################################
'Modificate i seguenti parametri di configurazione dove necessario'
'-----------------------------------------------------------------'
Dim local_file,timeout,cache_time,news_number,ntrim,remote_file,remote_url
Session.LCID = 1040 'Time Format
local_file = "D:\Inetpub\webs\styleintimoit\news.txt" 'Percorso del file news.txt sul vostro server. È necessario il percorso assoluto.
timeout = 10 'Timeout in caso di problemi al server di !pc-facile - non modificare a meno di necessità
cache_time = 1800 'Numero di secondi che devono intercorrere tra gli aggiornamenti della cache.
'NON abbassare questo valore sotto i 1800 secondi di default
news_number = 10 'Numero di news che si vogliono esporre sul proprio sito - il massimo è 10
ntrim = 1000 'Accorcia titoli troppo lunghi a $trim caratteri.
'Se non si vuole usufruire di questa opzione usare un numero molto alot: eg 1000
'##################################################################
'## Questi due non devono essere modificati per il corretto funzionamento delle news
'## a meno che non specificato dal WebMaster di Pc-Facile
remote_url = "http://www.pc-facile.com/"
remote_file = remote_url & "news.txt" 'Percorso del file news.txt su !pc-facile - da non modificare
'------------------------'
'Configurazione terminata'
Dim i,IDNews,ListNews,TimeNews,DateNews,ShortTitle
Check_News
Dim ListHTML
ListHTML = ReadNews
For i=0 To news_number - 1
ListNews = Split(ListHTML(i),";:;")
IDNews = ListNews(0)
TitNews = ListNews(1)
If (ntrim < 80) Then
ShortTitle = Left(TitNews, ntrim) & "..."
Else
ShortTitle = Left(TitNews, ntrim)
End If
TimeNews = ListNews(2)
DateNews = ListNews(3)
'##################################
'### Inizio Layout ###
'##################################
Response.Write "<strong>·</strong> "
Response.Write "<a href=""http://www.pc-facile.com/" & IDNews & """ title=""" & TitNews & """ target=""_blank"" >"
Response.Write "" & ShortTitle & ""
Response.Write "</a>"
Response.Write "<br>"
'##################################
'### Fine Layout ###
'##################################
Next
'-------------------------------------------------------------
' ATTENZIONE!!! NON modificare nulla oltre questo punto!
'-------------------------------------------------------------
Function Check_News
Dim fso,MyFile,intOra,intMin,inSe,OraAttuale,Diff,LastUpdate,ntrim
file = server.mappath(local_file)response.write "file=" & file
set fso = Server.CreateObject("Scripting.FileSystemObject")
'## Check if file exist ##
If fso.fileExists(file) Then '## It Exists, ok
Set Myfile = fso.GetFile(file)
LastUpdate = FormatDateTime(Myfile.DateLastModified,3) '## LastUpdate of the local file
intOra = DatePart("h", time() ) '## Get Hours
If (intOra < 10) Then
intOra = "0" & intOra
End If
intMin = DatePart("n", time() ) '## Get Minutes
If (intMin < 10) Then
intMin = "0" & intMin
End If
intSec = DatePart("s", time() ) '## Get Seconds
If (intSec < 10) Then
intSec = "0" & intSec
End If
OraAttuale = intOra & "." & intMin & "." & intSec '## Now
Diff = OraAttuale - LastUpdate '## Check if old
If (Diff > cache_time) Then
RefreshNews (news_number)
End If
else
'## file not found ##'
RefreshNews (news_number)
end if
set fso = nothing
End Function
Function ReadNews
Dim fso,MyFile,intOra,intMin,inSe,OraAttuale,Diff,LastUpdate
Dim news_number
file = server.mappath(local_file)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Myfile = fso.OpenTextFile(file, 1)
counter = 1
content = ""
Dim content2(10)
numArr = 0
If (news_number > 10) Then '## Max 10 News, or Error!
content2 = "Impostare un massimo di 10 News!"
Else
Do While NOT Myfile.AtEndOfStream
Myline = Myfile.ReadLine
content2(numArr) = Myline
numArr = numArr + 1
Loop
End If
Myfile.Close
set Myline = nothing
set fso = nothing
ReadNews = content2
End Function
Function RefreshNews (newNum)
Dim oStream,NewFile,res,objTextFile,objFSO
file = server.mappath(local_file)
'Response.Write "<br><br>Aggiornamento<br><br>"
Set FSO = Server.CreateObject("Scripting.FileSystemObject") '## Object For File
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") '## Object For URL
Set myStream = Server.CreateObject("ADODB.Stream") '## Object For Stream
Set Myfile = FSO.CreateTextFile(file, True) '## CreateFile, or overwrite it
objXmlHttp.open "GET", remote_file, False '## Open URL
objXmlHttp.SetRequestHeader "Content-type", "text/html" '## Send some Headers
objXmlHttp.setRequestHeader "Connection", "Keep-Alive" '## Send some Headers
objXmlHttp.send '## Send URL
If objXmlHttp.readyState <> 4 then '## Wait up timeout
objXmlHttp.waitForResponse timeout
End If
If objXmlHttp.status <> 200 Then '## Check for URL Error
' Error loading file
Myfile.WriteLine "Errore nel caricamento delle news remote" '## Write an error to file
Else
'## Response From Server ##
Response.Write "<xmp>" '## Patch for VBCrlf <xmp> doesn't process code
strHTML = objXmlHttp.responseText '## Put Response, in var
Response.Write "</xmp>" '## Close Patch <xmp>
'## Write to local file ##
Myfile.WriteLine server.HTMLEncode(strHTML) '## Write news to file
End If
Myfile.Close
Set objXmlHttp = Nothing
set FSO = Nothing
End Function
%>