webForumDet fria alternativet

skapa en RSS-fil

ASP

3 svar · 402 visningar · startad av Vinnaren

Medlem sedan sep. 2005833 inlägg
Frågan#1

Hej

Jag ska skapa en rss fil genom att loopa ut alla poster i databasen till den.
har hittills denna kod:

<!--#INCLUDE FILE="../inc/db.asp"-->
<%
Set fso = CreateObject("Scripting.FileSystemObject") 

if not fso.FileExists(Server.MapPath("../rss/blogg.rss")) then
    Set act = fso.CreateTextFile(Server.MapPath("../rss/blogg.rss"), true)
else
    Set act = fso.OpenTextFile(server.mappath("../rss/blogg.rss"))
end if

Set RSS = objConn.Execute("SELECT TOP 10 bID, Rubrik, RSS, Datum, Tid FROM Blogg ORDER BY Datum DESC")

act.WriteLine "<?xml version=""1.0"" encoding=""utf-8"" ?>"
    act.WriteLine "<rss version=""2.0"">"
        act.WriteLine "<channel>"

            act.WriteLine "<title>RSS</title>"
            act.WriteLine "<link>http://www.wwwwww.ww</link>"
            act.WriteLine "<description>RSS</description>"

            DO WHILE NOT RSS.EOF
            
                act.WriteLine "<item>"
                    act.WriteLine "<title>"&RSS("Rubrik")&"</title>"                    
                    act.WriteLine "<link>"&RSS("bID")&"</link>"
                    act.WriteLine "<description>"&RSS("RSS")&"</description>"
                    act.WriteLine "<pubDate>"&RSS("Datum")&"</pubDate>"
                act.WriteLine "</item>"
                
            RSS.MoveNext
            loop
            RSS.close
            set RSS = Nothing   
                        
        act.WriteLine "</channel>"
    act.WriteLine "</rss>"
    
act.close
%>

Problemet är att ingen fil skapas, har gett mappen alla rättigheter.
Får felmeddelandet:
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.

Vad har jag gjort för fel & hur löser jag det??

Tacksam för all hjälp :stud

Medlem sedan nov. 20014 054 inlägg
#2

Vinnaren skrev:

Hej

Jag ska skapa en rss fil genom att loopa ut alla poster i databasen till den.
har hittills denna kod:

<!--#INCLUDE FILE="../inc/db.asp"-->
<%
Set fso = CreateObject("Scripting.FileSystemObject") 

if not fso.FileExists(Server.MapPath("../rss/blogg.rss")) then
    Set act = fso.CreateTextFile(Server.MapPath("../rss/blogg.rss"), true)
else
    Set act = fso.OpenTextFile(server.mappath("../rss/blogg.rss"))
end if

Set RSS = objConn.Execute("SELECT TOP 10 bID, Rubrik, RSS, Datum, Tid FROM Blogg ORDER BY Datum DESC")


act.WriteLine "<?xml version=""1.0"" encoding=""utf-8"" ?>"
    act.WriteLine "<rss version=""2.0"">"
        act.WriteLine "<channel>"

            act.WriteLine "<title>RSS</title>"
            act.WriteLine "<link>http://www.wwwwww.ww</link>"
            act.WriteLine "<description>RSS</description>"



            DO WHILE NOT RSS.EOF
            
                act.WriteLine "<item>"
                    act.WriteLine "<title>"&RSS("Rubrik")&"</title>"                    
                    act.WriteLine "<link>"&RSS("bID")&"</link>"
                    act.WriteLine "<description>"&RSS("RSS")&"</description>"
                    act.WriteLine "<pubDate>"&RSS("Datum")&"</pubDate>"
                act.WriteLine "</item>"
                
            RSS.MoveNext
            loop
            RSS.close
            set RSS = Nothing   
                        
        act.WriteLine "</channel>"
    act.WriteLine "</rss>"
    
act.close
%>

Problemet är att ingen fil skapas, har gett mappen alla rättigheter.
Får felmeddelandet:
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.

Vad har jag gjort för fel & hur löser jag det??

Tacksam för all hjälp :stud

Det tar väl för lång tid för scriptet att exekvera färdigt.. pröva att sätta server.scripttimeout till något högre..

Varför inte låta en asp-sida verka som rssfeed, på så sätt blir den mer dynamisk och man slipper skapa om filen om om igen för varje nytt inlägg...

bara fundering.. :)

Medlem sedan sep. 2005833 inlägg
#3

hjälpte tyvärr inte att höja server.scripttimeout. Jag vill undvika att anropa databasen onödigt mycket, därför vill jag ha det i en rss fil.

Medlem sedan sep. 2005833 inlägg
#4

ingen som vet hur jag kan få ut en fil :q

272 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
129 ms — deklarationer (db)
0 ms — hämta statistik (cache)
139 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)