ASP.NET MVC Routes Login/Logout Problem
Relatively new to ASP.NET MVC and little confused about how to do routing. My problem basically relates to "logged in" and "logged out routes" and having both as "/".
i.e. I have home/index for logged out user which appears as "/" but this has got me confused as to how I can have home/home for logged i开发者_开发知识库n user and still have "/".
I keep getting 127.0.0.1/home/home
I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.
Does anyone know how I can modify the routes dictionary (which will be binded ONCE at the start) so that the "/" can be shared for logged and non-logged users ?
Thanks?
Ideally each route should point to a distinct view, so if there's slightly varying functionality on that view for logged in users vs. logged out users, you should drive the difference in your view logic and not in routing. If you have significant chunks of HTML that would be different, consider exploring the Html.RenderAction
method.
精彩评论