This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>@ViewBag.Title - My ASP.NET MVC Spinner and Download Time Stats</title> | |
@Styles.Render("~/Content/css") | |
@Scripts.Render("~/bundles/modernizr") | |
<script src="~/Scripts/jquery-3.3.1.min.js"></script> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".animatedSpinnerContainer"). | |
html("<h2>The time took to download the file is: </h2><br><b><font style=\"color:red\">" + | |
returnedData.FileDownloadTime + | |
"</font></b>"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hideSpinner() { | |
window.clearInterval(SessionChecker); | |
var UserAgent = window.navigator.userAgent; | |
var InternetExplorer = /MSIE|Trident/.test(UserAgent); | |
if (InternetExplorer) { | |
//IE | |
$(".animatedSpinnerContainer").html(""); | |
} | |
else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkSessionState() { | |
SessionChecker = window.setInterval(function () { | |
//alert("check session state started"); | |
//check for session using AJAX again: | |
$.ajax({ | |
type: "POST", | |
url: "/Home/CheckForSpinnerSession", | |
success: function (returnedData) { | |
//alert(r); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult CheckForSpinnerSession() | |
{ | |
string returnvalue = "false"; | |
string fileDownloadTime = "false"; | |
if (HttpContext.Session["spinnerToken"] != null) | |
{ | |
returnvalue = Session["spinnerToken"].ToString(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult Download(FormCollection fc) | |
{ | |
//start the tier to measure the download time | |
System.Diagnostics.Stopwatch downloadTimer = new System.Diagnostics.Stopwatch(); | |
downloadTimer.Start(); | |
StringBuilder HTMLstring = new StringBuilder("<html><head></head><body><h1>Example PDF page. Spinner in ASP.NET MVC. thoughtsonprogramming.wordpress.com</h1></body></html>"); | |
Response.Clear(); | |
Response.ContentType = "application/pdf"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="col-md-4"> | |
| |
</div> | |
<div class="col-md-4"> | |
<!-- [if !IE] --> | |
<p style="text-align:center;display: none;" id="animatedSpinnerContainer" class="animatedSpinnerContainer"><img src="~/Images/spinner.gif" /></p> | |
<!-- [endif] --> | |
<!--[if gte IE 9 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="bootstrap.min.css"> | |
<script src="jquery-3.3.1.min.js"></script> | |
<script src="bootstrap.min.js"></script> | |
<title></title> | |
<script type="text/javascript"> |