public static GetUpdateInformation ( string userAgent ) : UpdateInformationResponse | ||
userAgent | string | |
return | UpdateInformationResponse |
protected void Page_Load(object sender, EventArgs e) { string userAgentText; bool runFromChecker = false; userAgent.Text = HttpUtility.HtmlEncode(Request.UserAgent); if (Request.QueryString["realversion"] != null) { userAgentText = this.Request.QueryString["realversion"]; runFromChecker = true; } else { userAgentText = this.Request.UserAgent; } UpdateInformationResponse response = Helpers.GetUpdateInformation(userAgentText, this.Request.Browser.ClrVersion); userResult.Text = response.Text; developerOnline.Text = String.Format(@"If your users have internet connectivity, the .NET Framework is only between {1} and {2} megs. Why such a wide range? Well, it depends on if they already have some version of .NET. If you point your users to the online setup for the {0}, that {3} MB download will automatically detect and download the smallest archive possible to get the job done.", Constants.DotNetOnline, Constants.DotNetOfflineMB - Constants.Version3OfflineMB, Constants.DotNetOfflineMB, Constants.DotNetOnlineMB); developerOfflineResult.Text = String.Format(@"If you are a developer and are distributing your code on CD or DVD, you might want to download the {0} on your media. The download is about {1} MB", Constants.DotNetOffline, Constants.DotNetOfflineMB); getdotnet.Visible = response.VersionCanBeDetermined; checkdotnet.Visible = response.CanRunCheckApp; // Hide the 4.5 checker section if // (a) we can't determine the dotnet version or // (b) we're on an OS that doesn't support .Net or // (c) the user has already run the checker so we know exactly what version they're on. // Note that the checkdotnet section in the header will still be displayed as long as the OS supports it dotnet45.Visible = response.VersionCanBeDetermined && response.CanRunCheckApp && !runFromChecker; }
protected void Page_Load(object sender, EventArgs e) { userAgent.Text = HttpUtility.HtmlEncode(Request.UserAgent); if (Request.QueryString["realversion"] != null) { userResult.Text = Helpers.GetUpdateInformation(Request.QueryString["realversion"], Request.Browser.ClrVersion); } else { userResult.Text = Helpers.GetUpdateInformation(Request.UserAgent, Request.Browser.ClrVersion); } developerOnline.Text = String.Format(@"If your users have internet connectivity, the .NET Framework is only between {1} and {2} megs. Why such a wide range? Well, it depends on if they already have some version of .NET. If you point your users to the online setup for the {0}, that {3} MB download will automatically detect and download the smallest archive possible to get the job done.", Constants.DotNetOnline, Constants.DotNetOfflineMB - Constants.Version3OfflineMB, Constants.DotNetOfflineMB, Constants.DotNetOnlineMB); developerOfflineResult.Text = String.Format(@"If you are a developer and are distributing your code on CD or DVD, you might want to download the {0} on your media. The download is about {1} MB", Constants.DotNetOffline, Constants.DotNetOfflineMB); if (userResult.Text.Contains("can't")) //This is the worst thing I've ever done. We will fix it soon. { getdotnet.Visible = false; checkdotnet.Visible = true; } if (userResult.Text.Contains("Mac") || userResult.Text.Contains("Linux")) //No, THIS is the worst thing I've ever done. We will fix it soon. { getdotnet.Visible = false; checkdotnet.Visible = false; } }
public void ProcessRequest(HttpContext context) { if (context.Request.RequestType == "GET") { var userAgent = context.Request["userAgent"]; context.Response.ContentType = "text/plain"; context.Response.Write(Helpers.GetUpdateInformation(userAgent).Text); } }
public void ProcessRequest(HttpContext context) { if (context.Request.RequestType == "GET") { var userAgent = context.Request["userAgent"]; var netVersions = userAgent.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Contains(".NET CLR")); Version version = GetNetVersion(netVersions); context.Response.ContentType = "text/plain"; context.Response.Write(Helpers.GetUpdateInformation(userAgent, version)); } }
public void CheckWindows10Shows46() { // Arrange const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"; // Act string message = Helpers.GetUpdateInformation(UserAgent).Text; // Assert Assert.IsTrue(Helpers.HasWindows10(UserAgent), "Windows 10 detection failed"); StringAssert.Contains(message, "4.6", "Windows 10 must have at least 4.6"); }
protected void Page_Load(object sender, EventArgs e) { getdotnet.HRef = Constants.DotNet35Url; userAgent.Text = "<strong>" + HttpUtility.HtmlEncode(Request.UserAgent) + "</strong>"; userResult.Text = Helpers.GetUpdateInformation(Request.UserAgent, Request.Browser.ClrVersion); developerOnline.Text = String.Format(@"If your users have internet connectivity, the .NET Framework is only between 10 and 60 megs. Why such a wide range? Well, it depends on if they already have some version of .NET. If you point your users to the online setup for the {0}, that 2.8 meg download will automatically detect and download the smallest archive possible to get the job done.", Constants.DotNet35Online); developerOfflineResult.Text = String.Format(@"If you are a developer and are distributing your code on CD or DVD, you might want to download the <a href=""{0}"">FULL OFFLINE .NET 3.5 installation</a> on your media. The download is about 200 megs, but again, that contains all the different 50-60 meg installs that any one system might need.", "http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe"); }
public void CheckRealVersion() { // Arrange const string UserAgent = ".NET Version 1.0"; const string RealVersion = "4.5.1"; const string CheckerApplicationText = "The .Net Checker application determined that you have"; const string UnableToDetermineText = "The application was not able to determine the exact version you have."; var releaseKey = 0; // Act string message = Helpers.GetUpdateInformation(UserAgent, RealVersion, releaseKey).Text; // Assert StringAssert.StartsWith(message, CheckerApplicationText); StringAssert.Contains(message, RealVersion); Assert.IsFalse(message.Contains(UnableToDetermineText), "The '...not able to determine the exact version...' message should NOT appear if realVersion is present and releaseKey=0"); foreach (var releaseVersion in Constants.ReleaseVersions) { // Arrange releaseKey = releaseVersion.Key; // Act message = Helpers.GetUpdateInformation(UserAgent, null, releaseKey).Text; // Assert StringAssert.StartsWith(message, CheckerApplicationText); StringAssert.Contains(message, releaseVersion.Value); Assert.IsFalse(message.Contains(UnableToDetermineText), "The '...not able to determine the exact version...' message should NOT appear if releaseKey is contained in Constants.ReleaseVersions"); // Arrange releaseKey = releaseVersion.Key + 1; // Act message = Helpers.GetUpdateInformation(UserAgent, null, releaseKey).Text; // Assert StringAssert.StartsWith(message, CheckerApplicationText); StringAssert.Contains(message, releaseVersion.Value + " or greater"); StringAssert.Contains(message, UnableToDetermineText, "The '...not able to determine the exact version...' message SHOULD appear if releaseKey is not contained in Constants.ReleaseVersions"); } }