2

I am new to MVC3 and so far I think its awesome. Very different however.

In one directory there is hundreds of .cshtml names in a format of: 01-01-01.cshtml. I cant return this view from the controller because the format of the named .cshtml is not recognised.

This link: How to get current page URL in MVC 3

It has a similar problem but is not the same.

What would be the best, fastest way to handle this problem without renaming all my files? (I don't want to do this)

4

1 回答 1

2

这里的功劳是 PSL 的我已经使用该信息来解决这个问题。还归功于:stackoverflow.com/a/4969381/1183804 最初发布此答案。

我的 cshtml 名称:

01-01-01.cshtml

在控制器中:

[ActionName("01-01-01")]
public ActionResult U010101()
{
    return View();
}

并调用此视图:

@Html.ActionLink("<LinkName>", "01-01-01", "<ControllerName>") 

同样,这个功劳需要从上面的评论中转到 PSL。

希望这对其他人有帮助。

于 2013-05-17T23:35:18.530 回答