Get MVC Version


Introduction

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:-

Code of Home Controller

  
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();
        }

    }
}

  
Now execute this code


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

Email Address

For any query you can mail me at info@viastudy.com.


No comments:

Post a Comment