I got:
using System.Diagnostics;
using System.Reflection;
namespace Site
{
public abstract class General
{
private static string _version;
public static string Version { get { return _version; } }
static General()
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
_version = fileVersionInfo.ProductVersion;
}
}
}
The code works fine and I can get the version anywhere I need accessing Site.General.Version. Now I’m trying to use the inline tag <% = Site.General.Version %> but I’m getting a error message saying System.ComponentModel.ISite does not contain a definition or ‘General’…. I think there’s a namespace conflict because of the interface ISite.
How can I solve this?
Try adding this to the top of your aspx
And change your code like this
EDIT
This is the syntax to do it for all pages on web.config