Response Content type as CSV

Using text/csv is the most appropriate type. You should also consider adding a Content-Disposition header to the response. Often a text/csv will be loaded by a Internet Explorer directly into a hosted instance of Excel. This may or may not be a desirable result. The above will cause a file “Save as” dialog to appear … Read more

What is the @Html.DisplayFor syntax for?

Html.DisplayFor() will render the DisplayTemplate that matches the property’s type. If it can’t find any, I suppose it invokes .ToString(). If you don’t know about display templates, they’re partial views that can be put in a DisplayTemplates folder inside the view folder associated to a controller. Example: If you create a view named String.cshtml inside … Read more

The localhost page isn’t working. localhost redirected you too many times

I got a problem when debugging my MVC program and I want to acces to my db called “UserActivity”. on the browser, it saying that “The localhost page isn’t working localhost redirected you too many times.” but without showing the specific error location. here is my UserActivtyController, GET /UserActivity/Index code: Really appreciate if there anyone … Read more

Maximum request length exceeded.

If you are using IIS for hosting your application, then the default upload file size is 4MB. To increase it, please use this below section in your web.config – For IIS7 and above, you also need to add the lines below: Note: maxRequestLength is measured in kilobytes maxAllowedContentLength is measured in bytes which is why the values differ in this config … Read more

Could not load file or assembly ‘Microsoft.ReportViewer.WebForms’

This link gave me a clue that I didn’t install a required update (my problemed concerned version nr, v11.0.0.0) ReportViewer 2012 Update ‘Gotcha’ to be aware of I installed the update SQLServer2008R2SP2 I downloaded ReportViewer.msi, which required to have installed Microsoft® System CLR Types for Microsoft® SQL Server® 2012 (look halfway down the page for installer) In the GAC … Read more