コード例 #1
0
        internal /*public*/ static string GetErrorText()
        {
            HttpContext context = HttpContext.Current;

            if (CustomErrors.GetSettings(context).CustomErrorsEnabled(context.Request))
            {
                if (_strErrorTextRemote != null)
                {
                    return(_strErrorTextRemote);
                }

                lock (_syncObjectRemote) {
                    if (_strErrorTextRemote == null)
                    {
                        _strErrorTextRemote = (new UrlAuthFailedErrorFormatter()).GetHtmlErrorMessage(true);
                    }
                }

                return(_strErrorTextRemote);
            }


            if (_strErrorTextLocal != null)
            {
                return(_strErrorTextLocal);
            }

            lock (_syncObjectLocal) {
                if (_strErrorTextLocal == null)
                {
                    _strErrorTextLocal = (new UrlAuthFailedErrorFormatter()).GetHtmlErrorMessage(false);
                }
            }
            return(_strErrorTextLocal);
        }
コード例 #2
0
        private void WriteErrorMessage(HttpContext context)
        {
            CustomErrors customErrorsSetting = CustomErrors.GetSettings(context);

            if (!customErrorsSetting.CustomErrorsEnabled(context.Request))
            {
                context.Response.Write((new FileAccessFailedErrorFormatter(context.Request.PhysicalPathInternal)).GetHtmlErrorMessage(false));
            }
            else
            {
                context.Response.Write((new FileAccessFailedErrorFormatter(null)).GetHtmlErrorMessage(true));
            }
        }