Thursday, 7 November 2013

Get Version of MVC through Code

Get Version of MVC through Code

If we need to gets the version of the MVC application using code or if we want to print the Version of MVC then we can show it using code.

For Example:-

Create a Controller name home and Create View name Index and add the following code:-

Home Controller/Index

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcApplication1.Controllers
    public class HomeController : Controller
        public ActionResult Index()
            Response.Write("Current Version of MVC is= "+typeof(Controller).Assembly.GetName().Version.ToString());
            return View();


The output of this code

Figure 1

In this way using this code we can show version of MVC.

No comments:

Post a Comment