Identify ASP.NET MVC Assembly Version
Introduction:
The MVC pattern separates of an application into three main parts.- The Model − Collection of classes are working with the business logic.
- The View − It is responsible for User Interfaace. It is a HTML format whose extension is cshtml.
- The Controller − Collection of classes are working data logic and business logic.
Description:
Every MVC application contains 3 folders that is controller, View and Model. Every controller contains controller action method which is responsible for create view to transfer data from controller to view through viewdata and viewbag, Tempdata.Everey model contains some properties and using this model class name reference using namespace inside controller we can access related properties of class for business logic implementation.
In case of entity data model creation that is edmx file automatically creates model class based on table name or reated data base object name and with related properties as same as column name of that table.
The Way To Find Assembly Version Without Using Code Called Design Time. In the solution explorer, expand "References" folder. Right click on System.Web.Mvc assembly and select "Properties" and you can find the version.
Steps To Be Followed At runtime using code:
Step 1:Create A Controller named “Home” .
Add the code given below in HomeController.cs for better results, as expected.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mvc_Version.Controllers {
public class HomeController: Controller {
//
// GET: /Home/
public string Version() {
return "<h2>The Installed Mvc Version In your System Is : "
+ typeof(Controller).Assembly.GetName().Version.ToString() + "</h2>";
}
}
}
We mentioned the controller action method version In HomeController.Cs. For this, we should change the action method name in RouteConfig.cs for better loading of the page. For the first time, we will make it a start page.
Add the highlighted code in your file of RouteConfig.Cs.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Mvc_Version {
public class RouteConfig {
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(name: "Default", url: "{controller}/{action}/{id}", defaults: new {
controller = "Home", action = "Version", id = UrlParameter.Optional
});
}
}
}
The information which you have provided is very good. It is very useful who is looking for MSBI online training Bangalore
ReplyDeletethanks for the feedback
DeleteIT's very informative blog and useful article thank you for sharing with us , keep
ReplyDeleteposting learn more From
.NET Online Course Hyderabad
thanks for the feedback
DeleteI like this very much. It is very useful for my research. It shows your interest in this topic very well. I hope you will post some more information about the software. Please keep sharing!
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Perde Modelleri
ReplyDeletesms onay
Mobil Odeme Bozdurma
nft nasıl alınır
ANKARA EVDEN EVE NAKLİYAT
TRAFİK SİGORTASI
Dedektor
web sitesi kurma
ASK KİTAPLARİ