Click here to Skip to main content
15,880,796 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionset gridview cell text null Pin
uspatel11-Dec-11 19:03
professionaluspatel11-Dec-11 19:03 
AnswerRe: set gridview cell text null Pin
Karthik Harve11-Dec-11 21:39
professionalKarthik Harve11-Dec-11 21:39 
GeneralRe: set gridview cell text null Pin
uspatel11-Dec-11 23:19
professionaluspatel11-Dec-11 23:19 
AnswerRe: set gridview cell text null Pin
Jitendra Parida - Jeetu11-Dec-11 23:45
Jitendra Parida - Jeetu11-Dec-11 23:45 
GeneralRe: set gridview cell text null Pin
uspatel12-Dec-11 0:52
professionaluspatel12-Dec-11 0:52 
QuestionCache Problem Pin
Shyamjith Cherukara11-Dec-11 18:07
Shyamjith Cherukara11-Dec-11 18:07 
QuestionUsing wiki templates Pin
_AnsHUMAN_ 11-Dec-11 17:17
_AnsHUMAN_ 11-Dec-11 17:17 
QuestionMVC Areas - Home Controller naming conflict Pin
DaveAuld11-Dec-11 14:03
professionalDaveAuld11-Dec-11 14:03 
I was expermenting with Area's, and even after following the various guides and registering the routes using the Namespace parameter, I'm still get the Naming Conflict on the HomeController.
VB
The request for 'Home' has found the following matching controllers:
ANSLWebToolkit.ANSLWebToolkit.Areas.Operations.HomeController
ANSLWebToolkit.ANSLWebToolkit.Controllers.HomeController


So, I created a new MVC project in VS2010. I then created a new Area called "Operations", then added a new "Home" controller under this new area.

According to all the docs, having controllers in each area (or the root) with the same name is perfectly acceptable, providing you register the routes using the Namespace parameter. So the clash I'm getting is on the default HomeController (original non-area) and the Operations area HomeController.

I have checked the controller and the route registration sections, and all appears to be fine;

The global.asax file;
VB
' Note: For instructions on enabling IIS6 or IIS7 classic mode, 
' visit http://go.microsoft.com/?LinkId=9394802

Public Class MvcApplication
    Inherits System.Web.HttpApplication

    Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection)
        filters.Add(New HandleErrorAttribute())
    End Sub

    Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

        ' MapRoute takes the following parameters, in order:
        ' (1) Route name
        ' (2) URL with parameters
        ' (3) Parameter defaults
        routes.MapRoute(
            "Default",
            "{controller}/{action}/{id}",
            New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional},
            New String() {"ANSLWebToolkit.Controllers"}
        )

    End Sub

    Sub Application_Start()

        RegisterGlobalFilters(GlobalFilters.Filters)
        RegisterRoutes(RouteTable.Routes)

        AreaRegistration.RegisterAllAreas()

        Debug.WriteLine("Registered Route Table: ")
        For Each item As Route In RouteTable.Routes
            Debug.WriteLine(item.Url)
        Next

    End Sub
End Class



The default HomeController;
VB
Namespace ANSLWebToolkit.Controllers

    Public Class HomeController
        Inherits System.Web.Mvc.Controller

        Function Index() As ActionResult
            ViewData("Message") = "Welcome to ASP.NET MVC!"

            Return View()
        End Function

        Function About() As ActionResult
            Return View()
        End Function
    End Class

End Namespace




The OperationsAreaRegistration class
VB
Namespace ANSLWebToolkit.Areas.Operations
    Public Class OperationsAreaRegistration
        Inherits AreaRegistration

        Public Overrides ReadOnly Property AreaName() As String
            Get
                Return "Operations"
            End Get
        End Property

        Public Overrides Sub RegisterArea(ByVal context As System.Web.Mvc.AreaRegistrationContext)
            context.MapRoute(
                "Operations_default",
               "Operations/{controller}/{action}/{id}",
                New With {.action = "Index", .id = UrlParameter.Optional},
                New String() {"ANSLWebToolkit.Areas.Operations"}
            )
        End Sub
    End Class
End Namespace


Anybody see what is wrong or how can I work out why even when using the namespace parameter, it still clashes. As you can see I put some debug to dump the route registration table and it is doing what it should;
Registered Route Table:
{resource}.axd/{*pathInfo}
{controller}/{action}/{id}
Operations/{controller}/{action}/{id}

Any help appreciated, I'm going loopy with this basic error!
Dave
Find Me On: Web|Facebook|Twitter|LinkedIn

Folding Stats: Team CodeProject


GeneralRe: MVC Areas - Home Controller naming conflict Pin
Richard MacCutchan11-Dec-11 22:26
mveRichard MacCutchan11-Dec-11 22:26 
QuestionSchema importer extension and target type ReadXml method ???? Pin
devboycpp11-Dec-11 7:48
devboycpp11-Dec-11 7:48 
QuestionBulk file uplaod from a folder Pin
yesu prakash10-Dec-11 0:45
yesu prakash10-Dec-11 0:45 
AnswerRe: Bulk file uplaod from a folder Pin
raju melveetilpurayil10-Dec-11 15:57
professionalraju melveetilpurayil10-Dec-11 15:57 
QuestionHOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
Member 32222648-Dec-11 17:57
Member 32222648-Dec-11 17:57 
AnswerRe: HOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
uspatel10-Dec-11 1:52
professionaluspatel10-Dec-11 1:52 
GeneralRe: HOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
Member 322226411-Dec-11 5:39
Member 322226411-Dec-11 5:39 
AnswerRe: HOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
Jitendra Parida - Jeetu12-Dec-11 18:45
Jitendra Parida - Jeetu12-Dec-11 18:45 
GeneralRe: HOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
Member 322226418-Dec-11 18:53
Member 322226418-Dec-11 18:53 
GeneralRe: HOW TO AVOID MASTER PAGE REFRESH -WHEN MENU ITEM IS CLICKED-NEED HELP Pin
Jitendra Parida - Jeetu18-Dec-11 22:14
Jitendra Parida - Jeetu18-Dec-11 22:14 
QuestionAttach an editor in as aspx page Pin
MalarGayu8-Dec-11 14:32
MalarGayu8-Dec-11 14:32 
AnswerRe: Attach an editor in as aspx page Pin
MalarGayu8-Dec-11 17:28
MalarGayu8-Dec-11 17:28 
GeneralRe: Attach an editor in as aspx page Pin
raju melveetilpurayil10-Dec-11 15:54
professionalraju melveetilpurayil10-Dec-11 15:54 
GeneralRe: Attach an editor in as aspx page Pin
MalarGayu11-Dec-11 9:02
MalarGayu11-Dec-11 9:02 
GeneralRe: Attach an editor in as aspx page [Link Updated] Pin
raju melveetilpurayil11-Dec-11 12:48
professionalraju melveetilpurayil11-Dec-11 12:48 
GeneralRe: Attach an editor in as aspx page Pin
MalarGayu11-Dec-11 12:51
MalarGayu11-Dec-11 12:51 
GeneralRe: Attach an editor in as aspx page Pin
MalarGayu11-Dec-11 14:02
MalarGayu11-Dec-11 14:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.