Git Product home page Git Product logo

mvcpages's People

Contributors

maxtoroq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

harishthigala

mvcpages's Issues

Unclear how to control OutputCache on plain Razor pages

This is more of a stupid question than an issue, but I'm not sure how to define the OutputCache either at a default level or for individual .cshtml pages.

Putting OutputCache attributes on controllers works as expected, I'm just not sure how it would work to insert as a directive in a .cshtml page.

MVC5 / Razor 3

Hi,

I tried using MvcPages with MVC5, and found the following error:

Inheritance security rules violated by type: 'MvcPages.MvcPage'. Derived types must either match the security accessibility of the base type or be less accessible.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Inheritance security rules violated by type: 'MvcPages.MvcPage'. Derived types must either match the security accessibility of the base type or be less accessible.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[TypeLoadException: Inheritance security rules violated by type: 'MvcPages.MvcPage'. Derived types must either match the security accessibility of the base type or be less accessible.]
   System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) +0
   System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +41
   System.Reflection.Assembly.GetType(String name) +14
   System.Web.WebPages.Razor.RazorBuildProvider.GetGeneratedType(CompilerResults results) +235
   System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results) +72
   System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results) +16
   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +9881921
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +299
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103
   System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) +165
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +43
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(String virtualPath, Type requiredBaseType) +28
   System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType(String virtualPath) +343
   System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance(IVirtualPathFactory factory, String virtualPath) +236
   System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType(String virtualPath) +261
   System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance(IVirtualPathFactory factory, String virtualPath) +132
   System.Web.WebPages.WebPageHttpHandler.CreateFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory) +58
   System.Web.WebPages.WebPageHttpHandler.CreateFromVirtualPath(String virtualPath) +59
   System.Web.WebPages.WebPageRoute.DoPostResolveRequestCache(HttpContextBase context) +462
   System.Web.WebPages.WebPageHttpModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +157
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Any ideas on how to resolve this?

Thanks,
Brian

Add PageName property to be used with Href

This is a common pattern I use to generate links without hard-coding the page's name:

string page = VirtualPath.Split('/').Last().Split('.').First();  
string id = UrlData[0];

<a href="@Href(page, id)">...</a>

It would be useful to have a PageName property for this purpose.

Model is null in TryUpdateModel(Model,includeProperties)

Hi max. As i already said in the disqus of your site i'm stuck with this error.

For example: in the ChangePassword you use this code:

 if (IsPost
      && TryUpdateModel()
      && ChangePassword(Model)) {      

and everthing works fine. Now, let's suppose i want to specify which properties of the model i want to include in the binding(for ex. jsut username). If I understand correctly I should write something like

 if (IsPost
      && TryUpdateModel(Model, includeProperties: new string[]{"username"})
      && ChangePassword(Model)) {      

Is that correct?
But in this case i get the argumentnullexception because model in null.

What am I doing wrong? Can you give an example of working code for this case?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.