sthibodeau
Technical User
How do i avoid my ASP text editor from including those characters as it is running my format of my HTML viewing. Here is my code and towards the end i do have a routine that should replace the </BR> with CRLF. Please have a look thanks...
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
strPassword = "testing"
If Request.Form("Action"
= "Submit" Then
If Request.Form("password"
= strPassword Then
If WriteToFile(Request.Form("file"
, Replace(Request.Form("content"
, VbCrLf, "</br>"
) Then
JSalert(Request.Form("file"
& " updated successfully."
Else
JSalert("Error writing to " & Request.Form("file"
& "."
End If
Else
JSalert("Invalid Password... Please Try Again."
End If
End If
Function JSalert(strAlert)
Response.Write "<script language=""javascript"">alert(""" & strAlert & """
</script>"
End Function
Function ReadAllTextFile(strFile)
Const ForReading = 1
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject"
On Error Resume Next
Set f = fs
penTextFile(Server.MapPath(strFile), ForReading, False)
If Err Then
ReadAllTextFile = ""
Exit Function
End If
ReadAllTextFile = f.ReadAll
f.Close
Set f = nothing
Set fso = nothing
End Function
Function WriteToFile(strFile, strText)
Const ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject"
'On Error Resume Next
Set f = fs
penTextFile(Server.MapPath(strFile), ForWriting, True)
If Err Then
WriteToFile = False
Exit Function
End If
f.Write strText
f.Close
Set f = nothing
Set fso = nothing
WriteToFile = True
End Function
Sub showContent(strFile, r, c)
If Request.Form("file"
= strFile AND Request.Form("Action"
<> "Reset" Then
showForm strFile, Request.Form("content"
, r, c
Else
showForm strFile, Replace(ReadAllTextFile(strFile), "</br>", VbCrLf), r, c
End If
End Sub
Sub showForm(strFile, strContent, r, c)
%>
<form method="POST">
<input type="hidden" name="file" value="<%=strFile%>">
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#000000"><font color="#FFFFFF" face="courier" size="1">Password: <input type="password" name="password" size="6"> <input type="submit" value="Submit" name="Action">
<input type="submit" value="Reset" name="Action"> (<%=strFile%>)
</font></td>
</tr>
<tr>
<td><p align="center"><textarea rows="<%=r%>" name="content" cols="<%=c%>"><%=strContent%></textarea></p></td>
</tr>
</table>
</form>
<%
End Sub
%>
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
strPassword = "testing"
If Request.Form("Action"
If Request.Form("password"
If WriteToFile(Request.Form("file"
JSalert(Request.Form("file"
Else
JSalert("Error writing to " & Request.Form("file"
End If
Else
JSalert("Invalid Password... Please Try Again."
End If
End If
Function JSalert(strAlert)
Response.Write "<script language=""javascript"">alert(""" & strAlert & """
End Function
Function ReadAllTextFile(strFile)
Const ForReading = 1
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject"
On Error Resume Next
Set f = fs
If Err Then
ReadAllTextFile = ""
Exit Function
End If
ReadAllTextFile = f.ReadAll
f.Close
Set f = nothing
Set fso = nothing
End Function
Function WriteToFile(strFile, strText)
Const ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject"
'On Error Resume Next
Set f = fs
If Err Then
WriteToFile = False
Exit Function
End If
f.Write strText
f.Close
Set f = nothing
Set fso = nothing
WriteToFile = True
End Function
Sub showContent(strFile, r, c)
If Request.Form("file"
showForm strFile, Request.Form("content"
Else
showForm strFile, Replace(ReadAllTextFile(strFile), "</br>", VbCrLf), r, c
End If
End Sub
Sub showForm(strFile, strContent, r, c)
%>
<form method="POST">
<input type="hidden" name="file" value="<%=strFile%>">
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#000000"><font color="#FFFFFF" face="courier" size="1">Password: <input type="password" name="password" size="6"> <input type="submit" value="Submit" name="Action">
<input type="submit" value="Reset" name="Action"> (<%=strFile%>)
</font></td>
</tr>
<tr>
<td><p align="center"><textarea rows="<%=r%>" name="content" cols="<%=c%>"><%=strContent%></textarea></p></td>
</tr>
</table>
</form>
<%
End Sub
%>