pt.so/251250

CSharp · Mvc

Model

using System;
using System.ComponentModel.DataAnnotations;

namespace HelloWorldMvcApp
{
	public class MensagemErro
	{
		public string Descricao { get; set; }
	}
}

View

@model HelloWorldMvcApp.MensagemErro
@{
	Layout = null;
}

<!DOCTYPE html>

<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Bootstrap 101 Template</title>
	</head>
	
	<body>
		<div class="container">
			<div class="col-md-6 col-md-offset-3">
				<h1>Hello Stranger</h1>
	
				@Html.Raw(Model.Descricao)
	
				<br/><br/>
			</div>
		</div>

		<!-- JS includes -->
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
		<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>		
		
	</body>
</html>

Controller

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

namespace HelloWorldMvcApp
{
	public class HomeController : Controller
	{
		[HttpGet]
		public ActionResult Index()
		{
			return View(new MensagemErro
			{ 
				Descricao = "Você ficou muito tempo inativo, e por isso sua <span style=\"font-weight: bold\">sessão caiu</span>. Retorne para a página inicial para continuar." 
			});
		}
	}
}
;