Search code examples
asp.netrazorengine

Create a URL in a template using RazorEngine


Useing the RazorEngine library from here - http://razorengine.codeplex.com/. I'm trying to create a URL with parameters where the parameters value comes from the @Model. This is the HTML I use for the URL:

<p>http://@Model.WebsiteURL/login.aspx?bookingid=@model.BookingID&user=@Model.EmailParent&password=@Model.Password&ReturnUrl=betaling.aspx</p>

But when the Razor engine try to parse the template I get this error: "Only one 'model' statement is allowed in a file." Do I remove the @model.??? so that it only is used ones it is OK.

How do I create this URL.

Thanks in advance

Anders Pedersen


Solution

  • <p>http://@Model.WebsiteURL/login.aspx?bookingid=@model.BookingID&user=@Model.EmailParent&password=@Model.Password&ReturnUrl=betaling.aspx</p>
    

    Notice the small "m" in the "@model.BookingID"... it needs to be a capital M.