Hi ramco1917,
Refer the code.
_ViewStart.cshtml
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="../../index2.html" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>A</b>LT</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>Invoicing</b> Software</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown user user-menu">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
@*<img src="images/img.jpg" alt="">*@
<b>@HttpContext.Current.User.Identity.Name</b>
<span class="fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="javascript:;"> Profile</a></li>
<li>
<a href="javascript:;">
<span class="badge bg-red pull-right">50%</span>
<span>Settings</span>
</a>
</li>
<li><a href="javascript:;">Help</a></li>
<li><a href="/Home/Logout"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
</ul>
<!-- Control Sidebar Toggle Button -->
<li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- search form -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-primary">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu" data-widget="tree">
<li class="header">MAIN NAVIGATION</li>
<li class="treeview">
<a href="#">
<i class="fa fa-edit"></i> <span>Administration</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="@Url.Action("Index", "User")"><i class="fa fa-circle-o"></i> Maintain User</a></li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-edit"></i> <span>Masters</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="@Url.Action("Index", "Location")"><i class="fa fa-circle-o"></i> Maintain Location</a></li>
<li><a href="@Url.Action("Index", "Product")"><i class="fa fa-circle-o"></i> Maintain Product</a></li>
<li><a href="@Url.Action("Index", "Customer")"><i class="fa fa-circle-o"></i> Maintain Customer</a></li>
@*<li><iframe id="if1" width="100%" height="254" style="visibility:visible" src="http://jagjit/ReportServer_NAVDEMO/Report1"></iframe> </li>*@
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-folder"></i> <span>Transactions</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="@Url.Action("Index", "Invoice")"><i class="fa fa-circle-o"></i> Maintain PADI </a></li>
</ul>
<ul class="treeview-menu">
<li><a href="@Url.Action("Index", "Ordr")"><i class="fa fa-circle-o"></i> Maintain PADI </a></li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-folder"></i> <span>Reports</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
@*<li><a href="@Url.Action("ReportTemplate", "Report", new { ReportName = "Report1", ReportDescription = "Performance Report"})"><i class="fa fa-circle-o"></i> G/l Ledger</a></li>*@
<li><a href="@Url.Action("ReportTemplate", "Report", new { ReportName = "Report1", ReportDescription = "Performance Report", Width = 100, Height = 650 })"><i class="fa fa-circle-o"></i> G/l Ledger</a></li>
</ul>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<hr />
<div class="container body-content">
<section class="content">
@RenderBody()
</section>
<hr />
<footer>
<strong>
Copyright © @(DateTime.Now.Year - 1)<span>-</span>@DateTime.Now.Year
<a href="#">AdminLTE</a>.
</strong> All rights reserved.
</footer>
</div>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
Global.asax
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace Error_Layout_Page_MVC
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
if (exception != null)
{
HttpException httpException = null;
if (exception is HttpException)
{
httpException = exception as HttpException;
}
Response.Clear();
Server.ClearError();
Response.Redirect(string.Format("~/Error/Index/?message={0}", HttpUtility.UrlEncode(exception.Message)));
}
}
}
}
Home Controller
public class HomeController : Controller
{
public ActionResult Index()
{
int i = int.Parse("test");
return View();
}
}
Error Controller
public class ErrorController : Controller
{
// GET: Error
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult Index(string message)
{
ViewBag.Message = message;
return View();
}
}
Home -> Index
@{
ViewBag.Title = "Index";
}
<h3></h3>
Error -> Index
@{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Message</h2>