ref.
在 config 模式底下輸入
# remote-management 1 start-addr <ip> end-addr <ip> service telnet http ssh https
<configuration> | |
<system.web> | |
<!-- KBytes --> | |
<!-- 500MB --> | |
<httpRuntime maxRequestLength="512000" /> | |
</system.web> | |
<system.webServer> | |
<security> | |
<requestFiltering> | |
<!-- Bytes --> |
public static void js(string func) | |
{ | |
var page = HttpContext.Current.Handler as Page; | |
page.ClientScript.RegisterClientScriptBlock(page.GetType(), "js", func, true); | |
// var script = new LiteralControl(string.Format("<script>{0}</script>", func)); | |
// page.Controls.Add(script); | |
} |
<configuration> | |
<system.web> | |
<customErrors mode="On"> | |
<!-- 先移除 --> | |
<remove statusCode="401" subStatusCode="-1" /> | |
<remove statusCode="403" subStatusCode="-1" /> | |
<remove statusCode="404" subStatusCode="-1" /> | |
<!-- 再增加 --> | |
<error statusCode="401" path="https://google.com" responseMode="Redirect" /> | |
<error statusCode="403" path="/403.html" responseMode="ExecuteURL" /> |
ref.
在 config 模式底下輸入
# remote-management 1 start-addr <ip> end-addr <ip> service telnet http ssh https
// 清除空白、換行 | |
public static string clear(string text) | |
{ | |
var cls = new[] { "\r", "\n", " ", " " }; | |
foreach (var cl in cls) | |
{ | |
text = text.Replace(cl, string.Empty); | |
} | |
return text.Trim(); | |
} |