This project is read-only.

MVC3: The model or inherits keywords can only appear once.

Feb 21, 2012 at 10:14 AM
Edited Feb 21, 2012 at 10:15 AM


I have a web application written in razor MVC3.
I'm trying to create a dynamic css, when I add the second parameter (model) I get the error:
The model inherits or keywords can only Appear once.

This is the controller:

public class StyleController : Controller { // // GET: /Style/ public string css1280x1024() { StyleModel myStyleModel = new StyleModel(); Response.ContentType = "text/css"; return Razor.Parse(System.IO.File.ReadAllText(Server.MapPath("/Content/style1280x1024.css")), myStyleModel); } }

This is StyleModel class:

    public class StyleModel
        public string colore = "#ff0000";

And style1280x1024.css start with this line:

@model NAMESPACE.Models.StyleModel

Anyone know where is the problem?
Feb 21, 2012 at 10:37 AM
I found the problem, it was my mistake. In the css there was a line saying: @model.colore
I removed it and it work! :-)