I have a partial view which is displayed on the top right of every one of my pages. It has a link but this it needs to change based on the page that I am on. So if I am on the home page, I need to display a login link in my partial view but if I am on the login page, I need to display a registration link. Anyone know how to do this using razor?
Share
You could get the current action and controller from RouteData:
But obviously a much better way is to write a custom HTML helper that will generate the proper link based on the context.