|
@page |
|
@{ |
|
Layout = ""; |
|
} |
|
@using System.Linq; |
|
@using System.Collections; |
|
@using System.Reflection; |
|
|
|
<html> |
|
|
|
<head> |
|
<title>netcoreinfo()</title> |
|
<style> |
|
body { |
|
/*font-family:sans-serif;*/ |
|
font-family: Segoe UI, SegoeUI, Helvetica Neue, Helvetica, Arial, sans-serif; |
|
} |
|
|
|
h2 { |
|
color: #512bd4; |
|
} |
|
|
|
.h { |
|
/* background-color:#9999cc; */ |
|
background-color: #7014e8; |
|
background-image: url(https://dotnet.microsoft.com/static/images/redesign/home-hero-bg.svg); |
|
font-weight: bold; |
|
/*color:#000000;*/ |
|
color: #fff; |
|
} |
|
|
|
.h img { |
|
float: right; |
|
} |
|
|
|
.m { |
|
background-color: #ffffff; |
|
text-align: right; |
|
} |
|
|
|
.m td { |
|
border: 0 !important; |
|
} |
|
|
|
.m img { |
|
float: right; |
|
} |
|
|
|
.e { |
|
/*background-color:#ccccff;*/ |
|
background-color: #7014e8; |
|
font-weight: bold; |
|
/*color: #000000;*/ |
|
color: #ffffff; |
|
width: 25%; |
|
} |
|
|
|
.v { |
|
/* background-color:#cccccc;*/ |
|
background-color: #f4f4f4; |
|
color: #000000; |
|
} |
|
|
|
table { |
|
width: 80%; |
|
border-collapse: collapse; |
|
} |
|
|
|
td, |
|
th { |
|
/*border: 1px solid #000000;*/ |
|
border: 1px solid #c8c8c8; |
|
font-size: 75%; |
|
vertical-align: baseline; |
|
padding: 3px; |
|
word-break: break-word; |
|
} |
|
|
|
.center { |
|
text-align: center; |
|
} |
|
|
|
.center table { |
|
margin-left: auto; |
|
margin-right: auto; |
|
text-align: left; |
|
} |
|
|
|
.center th { |
|
text-align: center !important; |
|
} |
|
</style> |
|
</head> |
|
|
|
<body> |
|
<div class="center"> |
|
<table> |
|
<tbody> |
|
<tr class="h"> |
|
<td> |
|
<a href="https://dotnet.microsoft.com/"> |
|
<img src=" https://upload.wikimedia.org/wikipedia/commons/e/ee/.NET_Core_Logo.svg" height="50" /> |
|
</a> |
|
<h1 class="p">.NET Core @Environment.Version</h1> |
|
</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
<br /> |
|
|
|
<table> |
|
<tbody> |
|
<tr> |
|
<td class="e">Environment OS Version</td> |
|
<td class="v">@Environment.OSVersion</td> |
|
</tr> |
|
<tr> |
|
<td class="e">OS Description</td> |
|
<td class="v">@System.Runtime.InteropServices.RuntimeInformation.OSDescription</td> |
|
</tr> |
|
<tr> |
|
<td class="e">OS Architecture</td> |
|
<td class="v">@System.Runtime.InteropServices.RuntimeInformation.OSArchitecture</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Process Architecture</td> |
|
<td class="v">@System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Framework</td> |
|
<td class="v">@System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Argments</td> |
|
<td class="v">@string.Join(" ", @Environment.GetCommandLineArgs())</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
|
|
<h2>Environment</h2> |
|
|
|
<table> |
|
<tbody> |
|
<tr class="h"> |
|
<th>Variable</th> |
|
<th>Value</th> |
|
</tr> |
|
@{ |
|
var env = Environment.GetEnvironmentVariables(); |
|
} |
|
@foreach (string key in env.Keys.Cast<string>().OrderBy(k => k)) |
|
{ |
|
<tr> |
|
<td class="e">@key</td> |
|
<td class="v">@env[key]</td> |
|
</tr> |
|
} |
|
</tbody> |
|
</table> |
|
|
|
<h2>HTTP Headers Information</h2> |
|
|
|
|
|
<table> |
|
<tbody> |
|
<tr class="h"> |
|
<th colspan="2">HTTP Request Headers</th> |
|
</tr> |
|
@{ |
|
var reqHeaders = Request.Headers; |
|
var resHeaders = Response.Headers; |
|
} |
|
@foreach (string key in reqHeaders.Keys.Cast<string>().OrderBy(k => k)) |
|
{ |
|
<tr> |
|
<td class="e">@key</td> |
|
<td class="v">@reqHeaders[key]</td> |
|
</tr> |
|
} |
|
<tr class="h"> |
|
<th colspan="2">HTTP Response Headers</th> |
|
</tr> |
|
@foreach (string key in resHeaders.Keys.Cast<string>().OrderBy(k => k)) |
|
{ |
|
<tr> |
|
<td class="e">@key</td> |
|
<td class="v">@resHeaders[key]</td> |
|
</tr> |
|
} |
|
</tbody> |
|
</table> |
|
|
|
@foreach (AssemblyName an in Assembly.GetExecutingAssembly().GetReferencedAssemblies()) |
|
{ |
|
Assembly asm = Assembly.Load(an.ToString()); |
|
|
|
Func<Type, string, string> AssInfo = (t, p) => |
|
{ |
|
var a = asm.GetCustomAttributes(t).SingleOrDefault(); |
|
|
|
if (a == null) return ""; |
|
|
|
var ppr = a.GetType().GetProperties().Where(pr => pr.Name == p).SingleOrDefault(); |
|
|
|
if (ppr == null) return ""; |
|
|
|
return (string)ppr.GetValue(a); |
|
}; |
|
|
|
<h2>@AssInfo(typeof(AssemblyTitleAttribute), "Title")</h2> |
|
@* <pre>@string.Join("\r\n",asm.GetCustomAttributes().Select(a=>a.ToString()));</pre> *@ |
|
<table> |
|
<tbody> |
|
<tr> |
|
<td class="e">Title</td> |
|
<td class="v">@AssInfo(typeof(AssemblyTitleAttribute), "Title")</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Copyright</td> |
|
<td class="v">@AssInfo(typeof(AssemblyCopyrightAttribute), "Copyright")</td> |
|
</tr> |
|
<tr> |
|
<td class="e">File Version</td> |
|
<td class="v">@AssInfo(typeof(AssemblyFileVersionAttribute), "Version")</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Informational Version</td> |
|
<td class="v">@AssInfo(typeof(AssemblyInformationalVersionAttribute), "InformationalVersion")</td> |
|
</tr> |
|
<tr> |
|
<td class="e">Description</td> |
|
<td class="v">@AssInfo(typeof(AssemblyDescriptionAttribute), "Description")</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
} |
|
|
|
|
|
<br /> |
|
<br /> |
|
<table class="m"> |
|
<tr> |
|
<td><img height="100" |
|
src="//img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2qVsJ?ver=3f74" /></td> |
|
</tr> |
|
</table> |
|
|
|
</div> |
|
|
|
</body> |
|
<html> |
Hi
Thanks for a good work!
When I try to run your application, my webserver give me the following error:
"An error occurred during the compilation of a resource required to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS0103: The name 'page' does not exist in the current context
Source Error:
Line 1: @page
Line 2: @{
Line 3: Layout = "";".
What is wrong here?
Via the web.config-file I have set the ASP.NET version to 2.0, since my webserver come up and tell me that I should do that.
Thanks in advance.
Regards,
Anders.