Why do my T4MVC generated links have "Area=" when I do not use or define areas? - asp.net-mvc-4

Using ASP.NET MVC 4 and T4MVCExtension 4.0, I generate a link with #Url.Action(T4Controllers.EnhancementList.ByVotes()) and get http://localhost:1025/Enhancements/EnhancementList?Area=. Any ideas on how to get rid of that extra-ugly url parameter?
Note: I thought of titling this "Areas? We don't need no stinkin' Areas."

Mostly the same as T4MVC #Url.Action(MVC.Controller.Action()) Renders "?Area=" Parameter in QueryString. Though I thought that was fixed earlier. What T4MVC version are you using?

Related

MVC based authentication templates in ASP.NET Core 2.0

When creating a new ASP.Net Core web project in ASP.Net Core 2.0, and choosing the 'Individual account' authentication option, the authentication views/controllers where originally implemented using ASP.Net MVC. Recently it appears they have been updated to use Razor pages. My questions is...is there a way I can revert the new project template to using the MVC instead of Razor pages or at the very least is there a way I can see what code the MVC template used to create?
Simply, no. Identity now comes with a Razor Class Library containing a default UI, which as you've noted, is Razor Pages-based. If you want the old-style MVC setup, you'll need to create it yourself. You can scaffold the Default UI pages into your project and then refer to these to move code into controllers/views. Then, when you're done with that, remove the default UI pages in your project, and turn off the default UI in general by using AddIdentity<TUser, TRole> instead of AddDefaultIdentity<TUser> (which adds the default UI under the hood).
FWIW, I used to be totally opposed to Razor Pages until I endeavor the same thing you're about to embark on. After moving all the code into controllers, I started to remember how much of a mess it actually was. There's so much boilerplate code involved in auth: sign in, sign out, registration, password resets, 2FA, third-party login, etc. You end up with monstrous controllers with hundreds or even thousands of lines of code. Even if you try to break it up into many different controllers, that just kind of makes it worse. Long and short, Razor Pages actually works pretty well for something like this. It keeps each unit of functionality self-contained, so you know exactly where your need to go to edit stuff. I'd encourage you to give it a go as-is, first, and see how it works for you.
Also, one of your main concerns may be the Web Forms style of routing with Razor Pages, where you the path becomes the URL, and if you're like me, that probably offends your sensibilities. This can actually be changed, though it's not documented well at all. You can simply specify whatever route you'd like the page to have with the #page directive. For example, you could do something like following in Login.cshtml:
#page "/signin"
Then, you can access the page via /signin, instead of /Identity/Account/Login.cshtml.

Pagedlist for asp.net core

In MVC 5 (.Net Framework 4.6) i used PagedList.Mvc with following solutions:
It separates query into pages and gets results for needed page (not all query results).
It used HtmlHelper to render group of buttons with needed filter!
I could customize numbers of pager buttons to display (if get large resultset).
In asp.net core 2.0 documentation https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/sort-filter-page i can't find 2 and 3 solutions.
Does anyone know better approach?
I tried PagedList from https://github.com/dncuug/X.PagedList it worked!
I used X.PagedList this link was very helpful
https://github.com/troygoode/PagedList/blob/master/README.markdown#example

document multiple version of API using swaggydoc on grails with same controller name under separate directory

I'm using swaggydoc plugin on my grails application to document the REST APIs. I have two versions of API, v0 and v1 and corresponding controllers with same name, one for each version like:
directory structure
and i have the Url mapping like "/my2api/v1"(controller:"api",namespace:'v1')
"/myapi/v0" (controller:"api", namespace:'v0')
and getting both versions of the API endpoints listed as /myapi/v0/activeContracts like here.
So my question is, how can I get the API end point listed with correct URLs with corresponding versions like /myapi/v0/activeContracts & /myapi/v1/activeContracts as i mentioned I've tried the mapping but it ill just pickup the first the last mapping and assign it to both versions.
Any help would be greatly appreciated.
For people facing the same prob, I couldn't find a solution using swaggyDocs and also came across some post suggesting it doesn't support API versioning so ended up switching to Grails RestApiDoc which provides a lot more control (changing the API conf by just editing the json) than I was able to get on swaggyDocs. But please do post if someone knows a way to work it out in swaggyDoc.

Can T4MVC work in VB.NET?

I've read around on this issue but I'm unclear if it's possible to get T4MVC working with VB.NET. I'm using T4MVC and ASP.NET MVC4.
I downloaded and installed T4MVCVB from this link and I've already installed the T4MVC package. I've renamed my helper from MVC to MVCH
My current problem is that when I try to use it within a View:
#Html.ActionLink("Home", MVCH.Home.Index)
I get this:
If I try to use it from a controller, such as:
Return View(MVCH.Home.Index)
It works no problem.
Has anyone been able to get T4MVC working with VB.NET?
T4MVCVB has not really been kept up to date with T4MVC, though I think it should still work. But note that when using it, you should not also import the T4MVC NuGet package. Instead, just use T4MVCVB by itself. I suspect that's why you're getting conflicts.

Where is #Html.MailTo in MVC 4?

I read on many forums suggesting to use #Html.MailTo to send emails using local client (i.e similar to "mailto:" in anchor.
But when I try doing that, I simply dont find "MailTo" option in intellisense... Am I missing something, or if its obsolete now, or if its a customer HtmlHelper?
#Html.Mailto is one of the Features of ASP.NET MVC 3 Futures. ASP.NET MVC 3 Futures includes a bunch of features which may become the part of ASP.NET MVC in future.
Inorder to use it you need to download it from codeplex
You can check all the features in Imran Baloch's Blog Post
Hope it helps.
You can use #Html.DisplayFor such as #Html.DisplayFor(modelItem => Model.emailAddress) and it will produce an email link.