MvcContrib TestHelpers broken in MVC3? - asp.net-mvc-3

I have just upgraded my project to MVC3 using Razor. The project includes MvcContrib and I am using the MvcContrib.TestHelper methods for testing redirects, view rendering, etc. When I run the project, all views and redirects are working fine, but now all of my unit tests that use these helper methods are failing. Anyone know why this might be? Is there an update to MvcContrib that I have to use? I thought the stuff in MvcContrib would be incorporated into MVC3 anyway . . .
Thanks

And the anwser is, yes, you have to get the latest version of MvcContrib, it seems. Got the most recent version and now everything is passing again.

Related

HtmlAgilityPack LoadFromBrowser method not found

I am using HtmlAgilityPack 1.6.2 within a .NET Core 2.0 Console application. HtmlWeb.Load function works fine but LoadFromBrowser function is not available. I got a compiler error. The testing code is copied from the tutorial page so it should be correct. Please advise how to use the API.
The LoadFromBrowser method requires the WinForm WebBrowser to work.
Since there is not WebBrowser in .NET Core 2.0, this method is not available.
This method could be available in the future by replacing the WebBrowser by an open source browser but there is currently no short-term plan for it.
EDIT: Answer comment
Is there still no solution for this?
I didn't try it, but some package support web browser for .NET Standard such as : https://www.nuget.org/packages/Selenium.WebDriver
So perhaps if you use this package to retrieve the HTML and use it with HAP, that will work.
I have the same prob, installed Selenium.WebDriver, but don't know how to use it with HAP to wait until JS is loaded.

Asp.Net webforms and Asp.Net MVC together deployment issue

I am trying to combine Asp.Net Webforms and Asp.Net MVC together for hybrid application, as per our requirement. I am referring the hanselman's article for this. It is working fine while running from Visual Studio. But when I have deployed over IIS7, it is giving issue when I tried to visit page which is there, developed using MVC.
It is giving 500 internal server error. And when I try to debug the deployed site it is not even hitting the controller but directly giving error.
I am unable to found the issue and also unable to run page developed using MVC.
Please let me know if any further details needed.
Attaching image here.
I think I have found the issue. In deployment dll's are not copied perfectly. So, I updated Entity Framework, clear everything and redeploy it again. It works.
Thanks.

Is it possible to use Razor 2.0 view engine under mono?

I was insterested in Razor 2.0's condition attributes feature, so I tried to port Razor 2.0 to my MVC3 apps. I followed this link and successfully run my simple app (with one HomeController, one Index action and one *~/Views/Home/Index.cshtml view) on Windows with ASP.NET.
But when I deployed my app on mono runtime on Ubuntu, it fails to run and continues to report an error of Cannot find view:
Server Error in '/' Application
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Home/Index.aspx ~/Views/Home/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx ~/Views/Home/Index.cshtml ~/Views/Home/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml
I googled for this error, most of the articles says it is a problem of view compiling, so I thought it is caused by mono cannot properly use the new Razor engine's compiler to compile Index.cshtml.
I then switched my app back to Razor 1.0 and everythings works fine under mono, so is it really a problem that mono cannot run Razor 2.0? or is there any quick solution to this problem?
Thanks
Razor pages worked with Mono, in theory, with version 2.10.x series, but you had to bundle Microsoft's assemblies with it into your Linux box.
Since Mono 2.11.1, these assemblies are now bundled by default in Mono, because Microsoft open sourced Razor recently (on March 2012).
Hence, if I were you I would try Mono 2.11.3 to see if the problem is already fixed upstream. If not, please file a bug in http://bugzilla.xamarin.com/ with a standalone testcase to reproduce it, and link to the bug from here.

Using SquishIt with MVC3

I'm trying to use SquishIt with MVC3. I downloaded the Nuget package and I can see it under the Project Reference. But I can't call any of the methods in it. I also tried importing the SquishIt framework, but that doesn't work either. Any pointers please?
Thanks
I had the same problem, but found out that you have to recompile after adding SquishIt from NuGet. Then it works like a charm.

Does anyone still use MvcContrib in .NET MVC3 projects?

Aside from T4MVC, does anyone use MvcContrib for MVC3 projects? We've decided to incorporate a prototype project that was built in MVC2 last year. It mainly uses the paging and sorting namespaces from MvcContrib, but also some fluent html helpers.
We want to upgrade the project to MVC3 and I am wondering if we should also try to remove some of the MvcContrib dependencies. Reasons to keep? Reasons to remove?
Yes, I use it in my projects. I use the Grid and the TestHelper extensively.
I am using TestHelper also, very useful and well written!
MvcContrib's strongly typed RedirectToAction gives you compile time errors if you delete or rename an action that you redirect to. With normal redirects, you're stuck with magic strings for action names, and as such the risk of overlooking a breaking change in your application.
The ModelStateToTempData attribute is also helpful as it lets you retain modelstate while you redirect from a update POST action back to the form page instead of returning a view directly from the update action (which is a bad practice).

Resources