本文整理汇总了C#中System.Web.HttpServerUtilityBase.Transfer方法的典型用法代码示例。如果您正苦于以下问题:C# HttpServerUtilityBase.Transfer方法的具体用法?C# HttpServerUtilityBase.Transfer怎么用?C# HttpServerUtilityBase.Transfer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpServerUtilityBase
的用法示例。
在下文中一共展示了HttpServerUtilityBase.Transfer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleBadConnectionStringException
public static bool HandleBadConnectionStringException(Exception exception, HttpServerUtilityBase server)
{
if (exception is InvalidOperationException && exception.Message.Contains("ConnectionString"))
{
// Probably a missing connection string.
server.Transfer(BadConnectionStringPage);
return true;
}
if (exception is ArgumentException
&& (
exception.Message.Contains("Keyword not supported")
|| exception.Message.Contains("Invalid value for key")
)
)
{
// Probably a malformed connection string.
server.Transfer(BadConnectionStringPage);
return true;
}
return false;
}
示例2: HandleUnhandledException
public static void HandleUnhandledException(Exception exception, HttpServerUtilityBase server,
bool isCustomErrorEnabled, ILog log)
{
if (isCustomErrorEnabled)
{
server.Transfer(ErrorPageLocation);
}
else
{
log.Error("Unhandled Exception trapped in Global.asax", exception);
}
}
示例3: OnApplicationError
public void OnApplicationError(Exception exception, HttpServerUtilityBase server, ILog log, IInstallationManager installationManager)
{
exception = UnwrapHttpUnhandledException(exception);
if (exception == null)
{
server.Transfer(ErrorPageLocation);
return;
}
if (HandleDeprecatedFilePathsException(exception, server, this))
{
return;
}
LogIfCommentException(exception, log);
if (HandleSqlException(exception, server))
{
return;
}
BlogRequest blogRequest = BlogRequest.Current;
if (HandleRequestLocationException(exception, blogRequest, installationManager, new HttpResponseWrapper(Response)))
{
return;
}
if (HandleBadConnectionStringException(exception, server))
{
return;
}
if (exception is HttpException)
{
if (((HttpException)exception).GetHttpCode() == 404)
{
return;
}
}
bool isCustomErrorEnabled = Context == null ? false : Context.IsCustomErrorEnabled;
HandleUnhandledException(exception, server, isCustomErrorEnabled, log);
}
示例4: HandleSqlExceptionNumber
public static bool HandleSqlExceptionNumber(int exceptionNumber, string exceptionMessage,
HttpServerUtilityBase server)
{
if (exceptionNumber == (int)SqlErrorMessage.SqlServerDoesNotExistOrAccessDenied
||
(exceptionNumber == (int)SqlErrorMessage.CouldNotFindStoredProcedure &&
exceptionMessage.Contains("'blog_GetConfig'"))
)
{
// Probably a bad connection string.
server.Transfer(BadConnectionStringPage);
return true;
}
if (exceptionNumber == (int)SqlErrorMessage.LoginFailsCannotOpenDatabase
|| exceptionNumber == (int)SqlErrorMessage.LoginFailed
|| exceptionNumber == (int)SqlErrorMessage.LoginFailedInvalidUserOfTrustedConnection
|| exceptionNumber == (int)SqlErrorMessage.LoginFailedNotAssociatedWithTrustedConnection
|| exceptionNumber == (int)SqlErrorMessage.LoginFailedUserNameInvalid
)
{
// Probably a bad connection string.
server.Transfer(DatabaseLoginFailedPage);
return true;
}
return false;
}