All Questions
Tagged with .net-4.5 asp.net-mvc-4
134
questions
31
votes
12
answers
42k
views
Entry point was not found exception
I have installed vs2012 (11.0.50727.1),
I opened a new MVC4 with .NET 4.5 solution,
i create a simple HomeController and as I've wanted to start it locally, i have received this very strange error:
...
31
votes
2
answers
53k
views
DelegatingHandler for response in WebApi
I am currently using several delegation handlers (classes derived from DelegatingHandler) to work on the request before it is sent, for things like validating a signature etc. This is all very nice, ...
30
votes
4
answers
44k
views
asp.net 4.5 custom membership provider configuration throws strange exception [duplicate]
My web site was initially written in MVC 4.0 RC using VS2010, .
I have just downloaded and installed VS2012, and upgraded my project to Dotnet Framework 4.5.
In my project I'm using a Custom ...
29
votes
2
answers
26k
views
Broadcasting message to all clients except self in SignalR
I realize that these questions are similar:
SignalR - Broadcast to all clients except Caller
Send a message to all clients in a Group, except for the current client
However, they are old and ...
28
votes
2
answers
29k
views
Unit Of Work & Generic Repository with Entity Framework 5
I'm using ASP.NET MVC 4 with Entity Framework 5. I have model classes and Entity Maps to map existing tables to those model classes. All this is setup fine and works great.
Now I want to mock this. I ...
24
votes
1
answer
36k
views
How can you get a .NET 4.5 website to run on IIS6?
I've got an old Windows 2003 server running IIS 6, and I chose .net 4.5 for my latest web app. Problem is I can't get it to run on the server...
.NET 4.0 framework is installed. I've run ...
22
votes
6
answers
45k
views
EF6 DBContext Dynamic Connection String
public partial class ProcessContext : DbContext
{
static ProcessContext()
{
Database.SetInitializer<ProcessContext>(null);
}
public ProcessContext()
: base("Name=...
21
votes
5
answers
94k
views
MVC 4 Connectionstring to SQL Server 2012
I've created a brand new MVC 4 application in C# using Visual Studio 2012. I'm trying to connect to a brand new SQL Server 2012 (Standard) instance but I can't seem to get my connection string set ...
20
votes
4
answers
32k
views
How to make WebSecurity.Login to login using username or email?
WebSecurity.Login in simplemembership take username and password, how to make it to login the user using username or email instead of just username?, to make the user free to enter his email or ...
19
votes
1
answer
12k
views
New .NET feature bundle and minification {version} wildcard doesn't work with directories?
I have the following pice of code which runs perfectly:
bundles.Add
(
new ScriptBundle("~/bundles/scripts")
.Include
(
"~/Scripts/jquery-{version}.js"
,"~/Scripts/jquery-...
18
votes
2
answers
24k
views
MVC and Entity Framework Html.DisplayNameFor with Composite ViewModel
I’m fairly comfortable with MVVM using WPF/Silverlight but this is my first attempt at an MVC Web Application…just an fyi for my background.
I’ve created a controller called TestSitesController which ...
18
votes
4
answers
5k
views
"routes.LowercaseUrls = true;" does not work?
I'm having trouble in setting my routes to lowercase by default. For some reason it does not work. I know I can set authorize and home to lowercase myself, but the Admin part (area) will still be ...
16
votes
3
answers
9k
views
MVC4 + async/await + return response before action completes
In my MVC4 app I need to add a controller for uploading and processing large files. Immediately after the file is uploaded I need to start async processing of that file and return response to the ...
14
votes
2
answers
6k
views
'Enable-Migrations' fails after upgrading to .NET 4.5 and EF 5
I just upgraded my MVC4 project to .NET 4.5 and EF5 and started using VS2012.
After realizing I needed to set-up auto-migrations in the Package Manager again I ran Enable-Migrations - ...
12
votes
3
answers
17k
views
visual studio 2012 RC Could not load type System.Web.Http.RouteParameter
I had VS 11 Beta, .net 4.5 and MVC 4 beta installed on my PC. I just downloaded the latest RC and now I get this error message when I try to run web projects. I tried reinstalling .net 4.5 and ...
12
votes
1
answer
19k
views
What install files in location - Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5
Please bear with me on this, I will try to explain as clearly as I can.
I started a new project (class library) which targets 4.5 and not the client profile 4.5.
I added a reference "System.Runtime....
10
votes
3
answers
15k
views
Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5
The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include ...
10
votes
2
answers
14k
views
Return before async Task complete
I'm working on an ASP.NET MVC 4 web application. I'm using .NET 4.5 and am trying to take advantage of the new asynchronous API's.
I have a couple situations where I want to schedule an async Task to ...
9
votes
4
answers
11k
views
.net 4.5 ASP.Net web API JSONP support
Does anyone know if returning JSONP is supported out of the box in .net 4.5 ASP.NET WEB API?
I've found plenty of "roll your own" for earlier versions of MVC or .net but there doesn't seem to be ...
8
votes
7
answers
7k
views
How to edit the Typescript 1.4 "specified task executable location"?
I'm updating a project to use the latest versions of everything.
I just updated the MVC 4 project from .Net 4.0 to .Net 4.5.1. I then updated the nuget packages(uninstalling some, and re-installing ...
8
votes
2
answers
3k
views
DbGeometry makevalid?
I'm new to this. I don't know how to use the SqlSpatialFunction MakeValid.
I have a DbGeometry which is a polygon. This polygon is not valid and I want to
make it valid.
Can anyone explain how to use ...
8
votes
2
answers
13k
views
Correct usage of await async in webapi
I have a WebApi that for each incoming request, calls 2 separate webservices, performs some post processing and returns the results.
The first webservice call is cached locally for 1 hour, and the ...
7
votes
6
answers
23k
views
DbContext not found in mvc 4
I'm creating a web application using Visual Studio 2012 and Framework 4.5 and I'm using MVC 4 and I'm stuck with a problem.
I need to use DbContext but I'cant find that in my project means I added ...
7
votes
2
answers
6k
views
Getting User Identity on my base Controller constructor
I have a base Controller on my ASP.NET MVC4 website that have a Constructor simple as this:
public class BaseController : Controller
{
protected MyClass Foo { get; set; }
public ...
6
votes
2
answers
14k
views
Method not found: 'System.Net.Http.Headers.MediaTypeHeaderValue System.Net.Http.Formatting.JsonMediaTypeFormatter.get_DefaultMediaType()'
I have a method named GetJSONResponse(...) and here's an extract:
var response = new HttpResponseMessage(httpResponseCode)
{
Content = objectToSerialize != null ?
...
6
votes
2
answers
869
views
How to work around MVC4's breaking change in how it renders bools in a view
We recently upgraded an existing .NET 4 MVC 3 project to .NET 4.5 and MVC 4.
Where we had this sort of thing in a view:
@Model.MyBool
<input type="hidden" name="foo" value="@Model.MyBool" />
...
6
votes
2
answers
2k
views
Associate multiple claims based identity providers to one user with ASP.NET
In an ASP.NET MVC 4 application using the .NET 4.5 framework in conjunction with Azure Access Control Service (ACS), I want to provide the users multiple authentication possibilities (i.e. Google, ...
5
votes
4
answers
19k
views
Failed to find or load the registered .Net Framework Data Provider
I got the following error: "Failed to find or load the registered .Net Framework Data Provider." It only occur in AppHarbor server, not my local
I use .Net mvc4 and mysql
I have added MySql.Data, ...
5
votes
3
answers
10k
views
Bad Request error using SendGrid SMTP email submission
I am currently using C# in MVC4 ASP.NET 4.5.
My application creates a user and then submits a registration email to that use to authenticate their email. To create this script, I followed this ...
5
votes
1
answer
454
views
Significance of the Route Name in MVC 4
I was looking at the Routing Concepts of MVC and specifically at the below line:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // Route Pattern
new { controller = "Home", ...
5
votes
2
answers
4k
views
Data Access Application Block for .NET 4.5 using MVC 4
I'm trying to develop an application using MVC 4.
Earlier I was using Generic repository for accessing my database .
But later I was suggested to use Data Access Application Block to access Data Base ...
5
votes
2
answers
1k
views
C# Async / Await never responding in MVC4
I've been struggling with async / await for a week now. Some background: the code below is part of an MVC4 website project. The website has a large number of API calls happening. The goal is to get ...
4
votes
3
answers
13k
views
Add a reference to the System.IdentityModel.Tokens DLL
How do I add a reference to the System.IdentityModel.Tokens dll?
It does not seem to come up in the Nuget Package Manager.
Do I need to download the DLL?
I have .Net 4.5 installed.
The following ...
4
votes
3
answers
4k
views
.Net 4.5 WCF Error 404.3 on IIS 7.5
I deployed a MVC4 web application including a wcf service.
when i try to browse to the .svc file i receive Error 404.3 (Error Code 0x80070032).
I tried all the relevant answers i read:
1. adding a ....
4
votes
3
answers
916
views
Why does MVC 4 dispose the controller when action await something?
Why is my controller being disposed after the await statement?
public async Task<ViewResult> MyAction()
{
await Task.Yield();
// controller disposed at this ...
4
votes
1
answer
1k
views
Could not load type 'StackExchange.Redis.HashEntry' from assembly 'StackExchange.Redis
I was trying to setup the RedisSessionProvider to use with my Azure website via the Nuget package that's available.
When I run my website I get the following error:
Could not load type '...
4
votes
1
answer
8k
views
How to return a 401 response and custom page?
Using an MVC4 application that uses .NET 4.5 and IIS 8. Is there a way to return a custom unauthorised page AND a 401 result, when a permission check fails?
I am also using Forms authentication and ...
4
votes
1
answer
8k
views
How to use my own dependency resolver in MVC4's APIController
Back in MVC3, I had a custom ControllerFactory which would use my own container (as abstracted by my business logic) to instantiate controllers and pass them services they needed.
I'm trying to ...
4
votes
1
answer
3k
views
ASP.NET MVC 4 OAuthWebSecurity is not working
In my ASP.NET mvc 4 application, I tried to implement Account/ExternalLogin
i configured,
Microsoft(Windows Live),
Facebook
with ClientID and ClientSecret and enabled GoogleOpenAuth
unfortunately ...
3
votes
2
answers
8k
views
Ajax.BeginForm to specify "GET" type posting
My view is as below:
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type=...
3
votes
1
answer
3k
views
Web API OData Controller and Authorization Attribute
I am trying to use an MVC style authorization filter as an attribute on the Get() action method of an OData Web API controller, but the authorization filter is ignored. Can authorize attributes be ...
3
votes
1
answer
11k
views
CSV change delimiter
i'm reading a CSV file and changing the delimiter from a "," to a "|". However i've noticed in my data (which I have no control over) that in certain cases I have some data that does not want to ...
3
votes
2
answers
1k
views
Incorrect type of ClaimsIdentity read from session cookie after recycling of worker process
In a VS 2012 / .NET 4.5 / ASP.NET MVC 4 application I have a custom identity type derived from ClaimsIdentity. It just adds a few readonly properties to the base class that read values from some ...
3
votes
1
answer
4k
views
How to get URL client is coming from behind a reverse proxy?
I have a Controller Action in which I:
Forward a URL to a 3rd party that the 3rd party re-directs the client to if an operation is successful.
The client then connects to the 3rd party and performs ...
3
votes
0
answers
925
views
Is enforceFIPSPolicy config key setting is not compatible with web applications/services?
Is enforceFIPSPolicy config key, as described here meant for windows application only?
On my development machine (Windows 7) I enabled FIPS and then If I created a simple console app, as follows:
...
3
votes
0
answers
2k
views
Configuration of System.Runtime.Caching vs Enterprise Library 5 caching block
As part of plans to migrate an existing website from .NET 4 to .NET 4.5.1 we have learned that we will need to move from using Enterprise Library 5 to version 6.
We're using the caching block in ...
3
votes
1
answer
363
views
ClaimsAuthorizationManager pull policies from database
I'm new to the Claims Security approach for authorizing users access to resources. I've been doing a lot of research and the majority of sites I've read have the policies for ...
3
votes
0
answers
397
views
Return file from MVC action with using statements?
To return a file from an action, you do:
return File(myStream, ...);
This means you can't wrap myStream in a using statement, which makes me sad. Suppose I had multiple things in using statements in ...
3
votes
2
answers
1k
views
Assembly created by Moles in VS2010 is referencing MVC3 and MVC4 after install of VS2012
Assembly 'dllname.Moles, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than ...
2
votes
1
answer
2k
views
ASP.NET Web API Controller Best Practice - Action Definitions
I'm running into a situation where my HttpGet action in my Web API controller has multiple ways to be called based on parameters specified in the query string.
I need to be able to handle the ...