Forum: ASP.NET |
Thema:
Re: Textfile öffnen!! |
Von:
G. Guest (
27.09.2005 12:56) |
Sub Page_Load()
Dim str_Filename
Dim str_FilePath
Dim arr_temp = 0
Dim arr_Line() As String
Dim str_Line As String
Dim str_State As String
Dim str_Component As String
Dim int_Pos AS Integer
Dim str_Color As String
str_Filename = Request.Querystring("FileName")
Dim str_TextFilePath As String = Configurationsettings.AppSettings("TextFilePath")
str_FilePath = str_TextFilePath & "\" & str_FileName
Dim fs_file As FileStream = new FileStream((str_FilePath), _
FileMode.Open, FileAccess.Read)
Dim read As StreamReader = new StreamReader(fs_file)
read.BaseStream.Seek(0, SeekOrigin.Begin)
Response.Write("<table border = 1 cellpadding = 0 cellspacing = 0 >")
Response.Write("<tr>")
Response.Write("<th> <font size=""4"" face=""Arial""> Status </font> </th> <th> <font size=""4"" face=""Arial""> Component </font> </th> <th> <font size=""4"" face=""Arial""> Log Text </font> </th> </tr>")
Response.Write("<tr>")
Do while read.Peek() > -1
arr_temp = read.ReadLine()
If arr_temp.IndexOf("ERROR") >= 0 Then
str_Color = "<td bgcolor=""Red""> <b> <font size=""2"" face=""Arial"" color = ""Yellow"">"
Else If arr_temp.IndexOf("WARNING") >= 0 Then
str_Color = "<td bgcolor=""Yellow""> <font size=""2"" face=""Arial"" color=""Black"">"
Else If arr_temp.IndexOf("SUCCESS") >= 0 Then
str_Color = "<td> <font size=""2"" face=""Arial"" color=""Green"">"
Else
str_Color = "<td> <font size=""2"" face=""Arial"">"
End If
arr_Line = arr_temp.Split(";")
str_State = arr_Line(0)
str_Component = arr_Line(1)
str_Line = str_Line.join(" ",arr_Line,1,4)
str_Line = str_Line.TrimEnd
int_Pos = str_Line.IndexOf(" ")
str_Line = str_line.substring(int_pos)
Response.Write(str_Color & str_State & " </td>" & str_Color & str_component & " </td>" & str_Color & str_Line & "</font> </td> </tr>")
Loop
Response.Write("</table>")
End Sub
Das ist der ganze Code zum Anzeigen der Textdatei!! Die wird so ja direkt geöffnet. Ich möchte aber das sie irgendwo zwischengespeichert wird, so das sie halt nicht geöffnet wird!
Betreff |
Von |
Datum |
|
|
Jens
Buthe
|
27.09.2005 13:10 |
|
|
G.
Guest
|
27.09.2005 13:54 |
|
|
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!