Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Feature: Dependency Injection Doesn't Work for Razor Layout Pages [216]

$
0
0
With the following BaseViewPage class:

public abstract class BaseViewPage : WebViewPage {
[Dependency]
public IAuthorizationService Authorization { get; set; }
}

In a standard razor view (with @inherits BaseViewPage at the top) the IAuthorizationService is resolved correctly. But in a Layout page (which also inherits from BaseViewPage) the Authorization property is null.

Looking at the comments in the following article it suggests that this is an issue with ASP.NET and is not specific to MVC.

http://bradwilson.typepad.com/blog/2010/10/service-location-pt11-view-page-activator.html

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>