Reputation: 4286
I am trying to extend the UrlHelper in asp.net Mvc but I do not know what is the issue in my code?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace workflow.helpers
{
public static class CustomUrls
{
public static string baseUrl(this UrlHelper helper)
{
return String.Format("/workflow");
}
}
}
I do not know why I can't see the new method in the Intel sense.
Edit, Web.Config File
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Optimization" />
<add namespace="workflow.helpers" />
</namespaces>
Upvotes: 0
Views: 32
Reputation: 10824
First include this line in your view:
@using workflow.helpers
Then you can use it in the view:
@Url.BaseUrl()
Upvotes: 2