Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What problems will I face if I force the use of keywords like "public" and "private" in ASP.NET MVC Area names?

Tags:

c#

asp.net-mvc

I'd like to name one of my APS.NET MVC 4.0 Areas "Public". When I add a new Area and names it "Public" Visual Studio instead gives me the name "_Public" - obviously protecting me from using a C# keyword for the Area. The name would be used both in the namespace and as a part of the class name of PublicController. I'd prefer that my public-facing URL didn't contain any underscores, so I've done a rename back to "Public" and so far it seems to work just fine - my Index-page is rendering fine.

Is there any reason I shouldn't go with "Public" without the underscore as the area name? What problems will I face in the future, if any?

like image 769
Nilzor Avatar asked Jan 08 '14 09:01

Nilzor


1 Answers

No Problem, It's generally a best practice to avoid reserved keyword. For now, there is no constraint from MVC side.

It'll not create any problem in future for sure. In case you require advance routing please refer following link

MVC custom routing with validation

Hope helps

like image 101
Dipal Mehta Avatar answered Oct 04 '22 05:10

Dipal Mehta