Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 669 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 669 Bytes

MVC Container for Web Forms

Container to allow Web Forms pages to act like MVC Controllers and call into Controllers via route names

Suggested Usage:

In Base Page:

	protected Lazy<MvcContainer> _mvc = new Lazy<MvcContainer>(() => new MvcContainer(new HttpContextWrapper(HttpContext.Current)));
	
	public MvcContainer Mvc
    {
        get { return _mvc.Value; }
    }
	
	public override void Dispose()
	{
		base.Dispose();

		if (_mvc.IsValueCreated)
		{
			_mvc.Value.Dispose();
		}
	}

In .aspx page:
	
	<div id="mainContents">
		<%=Mvc.Html.Action("#Action#", "#Controller#", new { Area = "#Area#" }) %>
	</div>