asp.net mvc 4 - Unable to install StructureMap.MVC4 on .NET 4, MVC 4, VS 2012

I am trying to install StructureMap.MVC4 for a project, created in Visual Studio 2012, .NET 4.0 and ASP.MVC 4.But I am getting below error: Could not install package 'Microsoft.AspNet.WebApi.Client 5.1.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:16 + install-package <<<< structuremap.mvc4 WebApi_...Read more

visual studio 2012 - How do I properly use NUGET, for MVC (ASP.NET) projects?

I've learned that NUGET will "Always" download the latest package and how to use the -version switch. However, on a recent project where different developers had different SUO files (Visual Studio) they would have the need to add other NUGET content to satisfy Build errors. (Yes we shouldn't be doing that ). But in attempting to clean up the mess, it seems as if NUGET does not clean up everything as it should. I validated this by debugging an issue and finding that the Web.Config still had bad references just last week. The problem of cou...Read more

asp.net mvc 4 - Could not load file or assembly 'System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies

Using Visual Studio 2015 & Sitecore 8.0I have created a new MVC project with .Net Framework 4.6.1, copied, and referenced the Sitecore.kernel.dll & Sitecore.mvc.dll. Replaced the existing web.config & global.asax with the sitecore files.Added a plain HTML page in the solution and tried to browse it (from VS). The page opens with this error Could not load file or assembly 'System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.This ...Read more

asp.net mvc 4 - Install-Package : Unable to find package 'Microsoft.AspNet.WebApi.Cors'

i have installed the nuget package for asp.net webapi 2.2.and now when i am executing this commandPM> Install-Package Microsoft.AspNet.WebApi.Corsfrom nuget package manager it is showing this error.Install-Package : Unable to find package 'Microsoft.AspNet.WebApi.Cors'.At line:1 char:1+ Install-Package Microsoft.AspNet.WebApi.Cors+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Co...Read more

asp.net mvc 4 - nuget package run on local not on server

i want to generate pdf from Razor view ,i used Rotativa nuget package or HiqPDF package ,it working fine on local machine but when i hosted on server it will give following error,help me to resolve an errorServer Error in '/' Application.Error 0x4EC. Check the HiQPdf.dep resource file can be found near the HiQPdf.dll assembly and the user has read and execute permissions for this file. Call SetDepFilePath() method if you placed the HiQPdf.dep in a different locationDescription: An unhandled exception occurred during the execution of the current...Read more

visual studio 2012 - publish asp.net mvc 4 site gave 404 on IIS 6 host

Newly created ASP.Net MVC 4, C# project with VS Express 2012 for Web, target .Net Framework version 4.0 (same as the remote host).Debugging directly through VS is find. After publishing to local folder, [original:There is no .aspx generated, only sitename.dll, there were even original .cshtml files] and copying to IIS Express C:\inetpub\www folder, http://localhost/Home is fine.But when I upload everything to host (according to info.aspx, server info: IIS 6.0, .Net Version 4.0.30319.239), http://domain/Home gave page cannot be found 404 error, ...Read more

asp.net mvc 4 - Uncaught TypeError: Cannot call method 'fineUploader' of undefined

What am I am doing wrong here? I am using ASP.NET MVC4 with Knockout.js & Require.js.Here is all the javascript files:app.contracts.jsrequirejs.config({ "baseUrl": "../../Scripts/app/administrator", "paths": { "app.contracts": "app.contracts", "ko": "../../lib/knockout-2.2.1", "jquery": "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min", "toastr": "../../lib/toastr", "moment": "../../lib/moment", "fineuploader": "../../lib/jquery.fineuploader-3.8.0", "model.contract": ".....Read more

asp.net mvc 4 - Cannot read property 'opacity' of undefined

I am loading the fine uploader in this manner:var uploader = new qq.FineUploaderBasic({ button: $("#docAddHref"), request: { endpoint: 'server/handleUploads' }, validation: { allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'], sizeLimit: 204800 // 200 kB = 200 * 1024 bytes }, callbacks: { onSubmit: function (id, fileName) { $messages.append('<div id="file-' ...Read more

asp.net mvc 4 - Display tabular data. Is there any option other than looping through dataset and generating a table in razor?

In my MVC application, I need to display data in tabular format (no edit, only readonly) in one of the razor view. Some of the columns should be hyperlink, a couple of columns showing image, and rest columns in plain text. I know one option is to loop through each row in the dataset (model), and build the table. Anyone has any idea if there is any other way of doing it? (without any third-party control)Any advice on this, much appreciated....Read more

asp.net mvc 4 - Add css, js or other content to a views head from partial views

I have found a few questions relating to this, but generally there are many different answers and they all seem very messy and complex.If that is what needs to be done, then ok i better sit down and tackle it.I want to know what the simplest and most efficient way is to add content to your head from partial views. Reason I need to do this is i need certain java script and jquery on each page and it differs from page to page. I donot just want to add them all in the _layout view....Read more

asp.net mvc 4 - Reading images from div in controller

I have created a index page<body> <div> <script src="~/Scripts/jquery-1.7.1.js"></script> <style> .thumb { height: 75px; border: 1px solid #000; margin: 10px 5px 0 0; }</style>@using (Html.BeginForm()){<input type="file" id="files" name="files[]" multiple /><output id="list"></output> <input type="submit" name="Post" />}<script> function handleFileSelect(evt) { var files = evt.target.files; // FileList object // Loop through the FileLis...Read more

asp.net mvc 4 - Redirect certain pages from HTTPS to HTTP

Google has indexed some of our pages with both HTTPS and HTTP.. I would like to redirect the ones that should not be HTTPS back to HTTP (301).This is an EPiServer 7 site, but is MVC essentially.I have the following in my controllers.. if (currentPage.RequireSsl != null && currentPage.RequireSsl.Value && !HttpContext.Request.IsSecureConnection) { if (HttpContext.Request.Url != null) { return this.RedirectPermanent(HttpContext.Request.Url.ToString().Replace("http:", "https:")...Read more