本文整理匯總了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])) {