-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessages.vb
18 lines (15 loc) · 1.37 KB
/
Messages.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
''' <summary>
''' Ñòðîêè îòâåòà êëèåíòó
''' </summary>
''' <remarks></remarks>
Public Module Messages
Private Const HttpErrorHead As String = "<?xml version=""1.0"" encoding=""utf-8""?><!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"" ""http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd""[<!ENTITY nbsp "" "">]><html xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"" xmlns:svg=""http://www.w3.org/2000/svg"" xmlns:xlink=""http://www.w3.org/1999/xlink"">" & _
"<head><meta name=""viewport"" content=""width=device-width, initial-scale=1"" /><title>{0}</title></head>"
Private Const HttpErrorBody As String = "<body>" & _
"<h1>{0} îøèáêà â ïðèëîæåíèè «{1}»</h1>" & _
"<h2>Îøèáêà HTTP {2} — {3}</h2><p>{4}</p><p>Ïîñåòèòü <a href=""/"">ãëàâíóþ ñòðàíèöó</a> ñàéòà.</p></body></html>"
Public Function FormatErrorMessageBody(ByVal statusCode As Integer, ByVal appName As String, ByVal ErrorText As String) As String
Dim desc = HttpWorkerRequest.GetStatusDescription(statusCode)
Return String.Format(HttpErrorHead, desc) & String.Format(HttpErrorBody, If(statusCode >= 500, "Ñåðâåðíàÿ", "Êëèåíòñêàÿ"), appName, statusCode.ToString, desc, ErrorText)
End Function
End Module