本文整理汇总了C#中System.Web.HttpResponse.SendFailure方法的典型用法代码示例。如果您正苦于以下问题:C# HttpResponse.SendFailure方法的具体用法?C# HttpResponse.SendFailure怎么用?C# HttpResponse.SendFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpResponse
的用法示例。
在下文中一共展示了HttpResponse.SendFailure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequestInner
//.........这里部分代码省略.........
// Create a new session
var session = Session.Create(request, this, new EnvelopeHandlerMulti());
// Send frame
DelegateFrame.SendFrame(response, session);
return;
}
// If robots
if (request.Path.ToUpperInvariant() == "/ROBOTS.TXT") {
Robots(context);
return;
}
// Check we have WAR
if (null == HttpRootFile) {
response.Write("No WAR.");
return;
}
// If needed, upgrade the connection to HTTPS
if (RequireSecureHttp && !request.IsSecureConnection && string.Compare(request.Url.Host, "localhost", true) != 0) {
var url = request.Url.ToString();
url = "https" + url.Substr(url.IndexOf(":"));
response.Redirect(url);
return;
}
// Find target details
var path = request.Path == "/" ? "/index.html" : request.Path;
// Stop hacks
if (path.IndexOf("..") > -1 || path.IndexOf("//") > -1 || path.IndexOf("\\\\") > -1) {
response.SendFailure(HttpStatusCode.NotFound, "Denied.");
}
// Get content
byte[] page;
lock (WebCache) {
// Read cache
page = WebCache[path] as byte[];
// If cache miss..
if (null == page) {
// Open WAR file
if (null == HttpRoot) {
try {
HttpRoot = ZipFile.Read(HttpRootFile.FullName);
} catch (Exception ex) {
// Log the exception
LogException(ex, "Variant-HttpRoot", Ids.System);
// Warn users that we're updating
response.Write("We're currently updating our content. Hang tight - the site will be back shortly!");
return;
}
if (null == HttpRoot["/index.html"]) {
throw new Exception("Missing '/index.html' in WAR");
}
}
// Open file
ZipEntry file;
if (null == (file = HttpRoot[path])) {