views:

98

answers:

1

I have an ASP.NET site that is not currently using MVC but I'm trying to convert it to MVC slowly. The first time I tried using Url.Content in an .aspx page I got:

Name 'Url' is not declared

I then added:

<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

and:

<add namespace="System.Web.Mvc"/>

to the appropriate places in the web.config file, but it had no effect.

A: 

Your page needs to inherit from ViewPage so you'll need a page directive like this at the top of the aspx page...

<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

Also, not sure if you've seen it but this article by Maarten Balliauw might help :-)

http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

Russell Giddings