J. Ritchie CarrollGFS.Web: Cleaned up Error.cshtmlb1b61506 years agoHistory
211 lines · 6.8 KB · Text
RawDownload
@*******************************************************************************************************//  Error.html - Gbtc////  Copyright © 2017, Grid Protection Alliance.  All Rights Reserved.////  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See//  the NOTICE file distributed with this work for additional information regarding copyright ownership.//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may//  not use this file except in compliance with the License. You may obtain a copy of the License at:////      http://opensource.org/licenses/MIT////  Unless agreed to in writing, the subject software distributed under the License is distributed on an//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the//  License for the specific language governing permissions and limitations.////  Code Modification History://  ----------------------------------------------------------------------------------------------------//  08/14/2020 - J. Ritchie Carroll//       Generated original version of source code.////*****************************************************************************************************@@using System.Net.Http@using GSF@using GSF.Web@using GSF.Web.Model@using GSF.Web.Shared@inherits ExtendedTemplateBase@{    HttpRequestMessage request = ViewBag.Request;    Dictionary<string, string> parameters = request.QueryParameters();     bool showDebug = ViewBag.DebugBuild;    string debugParam;     if (parameters.TryGetValue("Debug", out debugParam)) {        showDebug = debugParam.ParseBoolean();    }     string exceptionDetails, exceptionMessage = "";     if (ViewBag.Exception == null) {        exceptionDetails = "Undetermined.";    }    else {        exceptionDetails = ViewBag.Exception.Message;         if (string.IsNullOrWhiteSpace(exceptionDetails)) {            exceptionDetails = "Undetermined.";        }        else {            //                                       12345678            int errIndex = exceptionDetails.IndexOf("- error:", StringComparison.Ordinal);            int eolIndex = errIndex > 0 ? exceptionDetails.IndexOf('\n', errIndex) : -1;             if (errIndex > -1 && eolIndex > -1) {                int startIndex = errIndex + 9;                int length = eolIndex - startIndex;                exceptionMessage = exceptionDetails.Substring(startIndex, length);            }        }    }     if (!string.IsNullOrWhiteSpace(exceptionMessage)) {        exceptionMessage = ":<br/><strong class='lead text-danger'>" + exceptionMessage + "</strong>";    }     string failedMessageStyle = "display: " + (showDebug ? "none" : "initial");    string manualMessageStyle = "display: " + (showDebug ? "initial" : "none");}<!DOCTYPE html><html lang="en"><head>    <meta charset="utf-8"/>    <meta http-equiv="X-UA-Compatible" content="IE=edge">    <meta name="viewport" content="width=device-width, initial-scale=1">    <title>Server Error</title>    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />    <link href="@Resources.Root/Shared/Content/bootstrap.css" rel="stylesheet">    @Raw(Resources.HeaderIcons)    <style>        body {            padding-top: 20px;            margin-left: 10px;        }         pre {            height: 600px;            width: 90%;            margin: 50px;            word-wrap: break-word;            overflow: scroll;        }         .pre-cache {            position: absolute;            left: -999em;            visibility: hidden        }         .glyphicon-spin {          -webkit-animation: spin 1.25s infinite linear;          -moz-animation: spin 1.25s infinite linear;          -o-animation: spin 1.25s infinite linear;          animation: spin 1.25s infinite linear;        }         @@-moz-keyframes spin {          0% {            -moz-transform: rotate(0deg);          }          100% {            -moz-transform: rotate(359deg);          }        }         @@-webkit-keyframes spin {          0% {            -webkit-transform: rotate(0deg);          }          100% {            -webkit-transform: rotate(359deg);          }        }         @@-o-keyframes spin {          0% {            -o-transform: rotate(0deg);          }          100% {            -o-transform: rotate(359deg);          }        }         @@keyframes spin {          0% {            -webkit-transform: rotate(0deg);            transform: rotate(0deg);          }          100% {            -webkit-transform: rotate(359deg);            transform: rotate(359deg);          }        }    </style></head><body>    <span class="glyphicon glyphicon-refresh pre-cache"></span>    <div id="header">        <h3 class="text-center">            <span id="response">Web server was not able to run or compile page@(Raw(exceptionMessage))</span>        </h3>        <h4 class="text-center">    @if (!showDebug) {            <span id="redirectMessage">                <span class="glyphicon glyphicon-refresh glyphicon-spin"></span>                &nbsp;&nbsp;Redirecting to home page...&nbsp;&nbsp;                <button id="cancelButton" type="button" class="btn btn-sm btn-warning">Cancel Redirect</button>                <br /><br />            </span>    }            <small>                <em>                    Click <a href="/">here</a>                    <span id="failedMessage" style="@failedMessageStyle">if page does not redirect</span>                    <span id="manualMessage" style="@manualMessageStyle">for home page</span>                </em>            </small>        </h4>    </div>     <pre id="exceptionDetails">Exception Details:<br /><br />@exceptionDetails</pre>    <script src="@Resources.Root/Shared/Scripts/jquery.js"></script>    <script src="@Resources.Root/Shared/Scripts/bootstrap.js"></script>    <script>        function calculateRemainingBodyHeight() {            return $(window).height() - $("#header").outerHeight(true) - 180;        }         function setExceptionDetailsHeight() {            $("#exceptionDetails").height(calculateRemainingBodyHeight());        }         $(window).resize(setExceptionDetailsHeight);         $(function () {            setExceptionDetailsHeight();        });    </script>@if (!showDebug) {    <script>        var canceled = false;         $("#cancelButton").click(function () {            canceled = true;            $("#failedMessage").hide();            $("#manualMessage").show();            $("#redirectMessage").hide();            setExceptionDetailsHeight();        });         $(function () {            setTimeout(function () {                if (!canceled)                    window.location = "/";            }, 2000);        });    </script>}</body></html>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t