How can I use T4MVC with the external login confirmation form in the default MVC5 project?

In the default ASP.NET MVC 5 web project, the "Login" view ("Login.cshtml") has a BeginForm call like this:

@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))

I'm trying to convert all my ActionLink, BeginForm (etc.) calls to use T4MVC, and so I changed it to:

@using (Html.BeginForm(MVC.Account.Login().AddRouteValue("ReturnUrl", (string)ViewBag.ReturnUrl), FormMethod.Post, new { @class = "form-horizontal", role = "form" }))

...which worked fine.

However, there's another form in "ExternalLoginConfirmation.cshtml", which starts like this:

@using (Html.BeginForm("ExternalLoginConfirmation", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))

I tried to use the same approach:

@using (Html.BeginForm(MVC.Account.ExternalLoginConfirmation().AddRouteValue(...)

...but the object returned by MVC.Account.ExternalLoginConfirmation has no AddRouteValue method.

I think this is because ExternalLoginConfirmation is an async action method that actually returns a Task<T> rather than just a T.

Is there any way I can get this to work with T4MVC, or do I simply need to leave this one alone? (I know I can just replace the magic strings using MVC.Account.ActionNames.ExternalLoginConfirmation and MVC.Account.Name), but it would be nice to be able to use the helper.


This is covered in this thread. Basically, try:


Need Your Help

Phonegap Contacts API - field names

cordova contacts field

Why is this sooooo difficult? All I want is a list of the field names in the Phonegap Contacts API. Not a big deal you would think, but it is - in fact, this is almost a generic problem with the Ph...

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hometools/com.example.hometools.HometoolsActivity

java android eclipse android-intent

I'm getting an error message when I try to run my project. This is for a college task, something simple. I believe the XML is ok.