All Questions
Tagged with .net-4.5 asp.net-mvc
130
questions
72
votes
3
answers
73k
views
Create zip file from byte[]
I am trying to create a Zip file in .NET 4.5 (System.IO.Compression) from a series of byte arrays. As an example, from an API I am using I end up with a List<Attachment> and each Attachment has ...
65
votes
7
answers
28k
views
TemporaryGeneratedFile_[guid] in /obj/debug breaking build
I have 3 temporary files being created in obj/debug:
E.g.
TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
...
42
votes
4
answers
90k
views
System.Web.Http is missing after a .NET 4.5 upgrade
I've just upgraded my solution to .NETE 4.5 using Target Framework Migrator, and then the package manager console command:
Update-Package -Reinstall -IgnoreDependencies
In one of my projects I am ...
27
votes
4
answers
25k
views
HTTP Error 403.14 - Forbidden - MVC4 .net 4.5 bundles
I made a MVC4 application with .net 4.5 using razor engine. It works fine when run locally with visual studio.
When I deploy to IIS on windows server 2008 R2(all windows updates done), it appears my ...
21
votes
2
answers
12k
views
Is MVC4 baked into .NET 4.5?
A lot of release notes for Visual Studio 2012 talk about .NET 4.5 and MVC4, but I can't tell if MVC4 is actually part of the .NET 4.5 release. Anybody know for sure? I would love not to have to ...
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 ...
14
votes
5
answers
18k
views
Predefined type System.Object is not defined or imported
I'm having this weird error only in .cshtml files in VS 2015.
The error doesn't show up when I open the project with VS 2013.
Error CS0246 The type or namespace name 'System' could not be found
(...
11
votes
2
answers
15k
views
POST a string to Web API controller in ASP.NET 4.5 and VS 2012 RC
I am new to WebAPI and trying to learn it. I have an WebAPI controller to which I am trying to POST a string using WebClient from my Unit Test.
I am posting a string to my WebAPI using following code ...
10
votes
3
answers
4k
views
ASP.NET bundling/minification: including dynamically generated Javascript
I have a site that dynamically generates Javascript. The generated code describes type-metadata and some server-side constants so that the clients can easily consume the server's services - so it's ...
10
votes
2
answers
6k
views
How can I delete generated folders and files via Wix on uninstall?
After an installation, I have the following folder structure in the folder C:\Program Files (x86):
The Path to the folder generated is: C:\Program Files (x86)\CompanyName\AppName\generated
The ...
10
votes
5
answers
18k
views
Compiler executable file csc.exe cannot be found in .NET 4.5 Azure deployment
I have a site which was and works:
ASP.NET 4
MVC 3
Entity Framework 4.3
Running in an Azure web role (i noticed it was osFamily="1" which is weird as I expected it to be 2 - but anyway...)
Azure SDK ...
9
votes
2
answers
10k
views
MaxLength Attribute in EF4.3.1
The type 'System.ComponentModel.DataAnnotations.MaxLengthAttribute'
exists in both
[path...]\packages\EntityFramework.4.3.1\lib\net40\EntityFramework.dll
and
'c:\Program Files (x86)\Reference ...
9
votes
3
answers
2k
views
Why is an old project name still being referenced in the temp files on Visual Studio
I created and fully baked an MVC C# intranet PROJECT_A.
Then I created and fully baked a WebForms C# intranet PROJECT_B.
Now I need to merge the two into a combo MVC/WebForms C# PROJECT_C.
I've done ...
9
votes
1
answer
6k
views
The program '[4432] iisexpress.exe' has exited with code -2147023895 (0x800703e9)
I have very frustrating issue with IIS Express. When I start debug everything is ok, but after few requests IIS hangs and crashes. My browser (Chrome Version 37.0.2062.120 m) waits for the response ...
8
votes
4
answers
11k
views
BootstrapContext is null on ClaimsIdentity
I have created a new ASP.NET MVC application with .NET 4.5. I have successfully set up authentication with an STS. The authentication flow is working fine and I am able to get the ClaimsIdentity, ...
7
votes
2
answers
3k
views
Call Async Method from Session_Start
How can I call an async method from Session_Start in Global.asax ?
Global.asax:
protected async Task Session_Start(object sender, EventArgs e)
{
Session.Timeout = 10;
...
7
votes
3
answers
490
views
How to deal with session left open
I am implementing a session structure.
I have a ConcurrentDictionary on server side holding on to all the <SessionId, UserSession> pairs.
When a new connection is established a cookie is ...
7
votes
1
answer
246
views
SdkUtility.LaunchSignInPage not redirecting to ebay sign in page
.Net 4.5 , MVC 5 , IIS 8
SdkUtility.LaunchSignInPage(apiContext, _sessionID);
From my application (in VS 2013) I can easily access to the sign in page. But problem occurs when I published it in IIS. ...
6
votes
1
answer
4k
views
Could not load file or assembly '' or one of its dependencies. The process cannot access the file because it is being used by another process
I have just bought a new development machine and have taken the latest version of the source code of a project we are working on but when I try to debug it I get the following error:
Could not load ...
6
votes
4
answers
10k
views
How to set SameSite value to None in .net 4.5.2?
When redirected back to my site from the third party site user session becoming empty.
I have checked Response.Cookies["ASP.NET_SessionId"]; sets new value after redirect.
By default, ASP....
6
votes
1
answer
4k
views
Difference between HostingEnvironment.QueueBackgroundWorkItem and HostingEnvironment.RegisterObject
Currently I am using HostingEnvironment.RegisterObject to run my background work in my MVC 5 app. Specifically I have,
public class BackgroundWorker
{
/// <summary>
/// Runs a ...
6
votes
1
answer
885
views
Is it possible to select an Action with AttributeRouting in .NET MVC based on the Media Type of the Accept header?
I want to select an Action of my Controller based on the Media Type requested in the Accept header.
For example, I have a resource called a subject. Its assigned route is:
GET /subjects/{subjectId:...
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" />
...
5
votes
3
answers
4k
views
Website upgraded to MVC 5 has missing DisplayMode property on ControllerContext
I recently updated my website to MVC 5. It ran well on my dev machine. when I moved to staging on shared hosting supporting .Net 4.0 where my MVC 4 site worked just fine. After deployment I received ...
4
votes
4
answers
11k
views
.NET 4.0 substitutes for .NET 4.5 namespaces
There is some code for an MVC application which was built using .NET 4.5 as a framework in VS 2012. My current system forces me to work on VS 2010. I managed to open the VS2012 solution in my VS2010, ...
4
votes
1
answer
10k
views
Why would FederatedAuthentication.WSFederationAuthenticationModule be null in MVC Azure ACS Federated Authentication?
I'm trying to put together FederatedAuthentication with .NET 4.5, MVC 4, and active redirect using a custom server-side login page, using code from this tutorial, and from this code sample.
...
4
votes
2
answers
10k
views
MVC4 .NET 4.5 async action method does not redirect
I am trying to implement a task action method in my MVC 4 application. Everything works on the back in, but it is not redirecting.
public class AccountController : AsyncController
{
[HttpPost]
...
4
votes
2
answers
2k
views
How to add bundles with dynamic content to asp.net web optimization
I'm using SignalR, which maps to asp.net application on virtual path "~/signalr".
SignalR dynamically creates javascript proxy hubs on app start with virtual path "~/signalr/hubs".
So the url "[http:/...
4
votes
2
answers
6k
views
MVC 5, WIF (System.IdentityModel) & ADFS not actually authenticating, errors on federated signout
I'm wading through the creation of a claims-based MVC site in Visual Studio 2013.
Some things I learned so far:
System.Identity is in, Microsoft.Identity is out
Many of the tutorials, including ...
3
votes
1
answer
5k
views
ADO.NET Entity Data Model doesn't update Entities
I'm using MySQL .NET Connector in my ASP.NET MVC project. The connection works fine.
However, after creating a ADO.NET Data Model from my MySQL database (with "Update Model from Database") for the ...
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
3
answers
2k
views
How can I programmatically stop the current website? [duplicate]
I am using the MVC5 for an web application. The web app runs in IIS7 or greater.
In the Global.asax on application_start, the number of licenses will be set:
protected void Application_Start()
{
...
3
votes
2
answers
989
views
Session state on couchbase
I want to use couchbase for session. I configured my web config. Also app framework is net 4.5.
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on ...
3
votes
1
answer
1k
views
FluentNHibernate SchemaUpdate isn't working
I have a problem updating the database schema using SchemaUpdate method of FluentNHibernate.
Here's my code:
Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2012.ShowSql()
....
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
1
answer
1k
views
EditorFor renders different for byte and short
Why does EditorFor renders different classes and input types for byte and short, as shown here:
<div class="form-group">
<input class="text-box single-line" data-val="true"
data-...
3
votes
2
answers
364
views
Is it possible to modify the ASP.NET bundler to include a version number with the bundled files?
I have started working recently with the new .net feature of bundling and minification as outlined by scott gu - http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-...
3
votes
1
answer
231
views
Create attribute for validation and change the parameter value
I need to get parameter in controller action and validate this parameter. For example:
public TestController
{
public ActionResult TestMethod(int testParamFromUri)
{
//here is my ...
3
votes
1
answer
352
views
ASP.net page navigation with Workflow
I am using .Net4.5 and visual studio 2012. Can someone tell me how to do ASP.net page navigation with Workflow 4.5 ?
1.) Unable to Create the class :
I have created an Empty MVC project and the i ...
3
votes
0
answers
693
views
MVC view compilation using wrong .NET Framework
An existing web application is using .NET Framework 4.5.1.
The project has the setting MvcBuildViews set to true.
The project also uses a Prepend extension method for IEnumerable<T>.
Stuff ...
3
votes
2
answers
551
views
How should I implement Nlog logger to reduce copy/paste tedium?
I'm working on a .NET solution that will include MVC and Web API controllers. After admitting I deserved better than a roll-your-own logging solution and could benefit from some of the features in a ...
3
votes
0
answers
1k
views
request.GetBufferedInputStream is not seek enabled
Before .NET 4.5, I was using request.InputStream to read the data and save it to a database. However, now instead of using the "Classic" input stream reading mechanism, it uses the Buffered Input ...
3
votes
1
answer
243
views
WEB API call stops working after introducing the "await" keyword
I have a simple web api method which retrieves a list of items from a database. When the method looks like this it works and the items are displayed in the UI:
[ActionName("GetServices")]
public ...
2
votes
2
answers
98
views
Clarification on tasks in .net
I'm trying to understand tasks in .net from what I understand is that they are better than threads because they represent work that needs to get done and when there is a idle thread it just gets ...
2
votes
3
answers
2k
views
Task continuation not working after await
I've encountered a pretty strange case when task execution is not continued after await in IIS (not sure if it's related to IIS). I reproduced this issue using Azure Storage and following controller (...
2
votes
1
answer
670
views
403.14 - Forbidden when controller name and controller directory name is same in IIS
I have below code where my controller name is Customer and it is part of the Customer directory in my web api 2 project. It seems that IIS doeasn't allow me to use same directory name and controller ...
2
votes
1
answer
425
views
How to Properly Get Nested Folders to Render in MVC 5 C#
I've got the traditional website with all MVC 5 working as expected, everything renders correctly and works fine.
I've added a Dashboard and this dashboard I am attempting to set to folder structure ...
2
votes
1
answer
2k
views
Can't build .NET 4.5 in VS2015 after VS2019 install
We have this (quite huge) solution in Visual Studio 2015, that consists of 60 projects of class libraries and a few MVC web projects, all with target framework set to .NET 4.5 (not 4.5.1 or the like, ...
2
votes
1
answer
711
views
403.13 when using action link to go to {controller}/Index
I am getting the following error when debugging my header links.
I have tried recreating my Index.cshtml (Empty and with Razor/HTML) and my ServicesController.
If I browse to Services/Index ...