All Questions
306
questions
40
votes
1
answer
6k
views
Portable Class Library in MVC 4 / Razor with Visual Studio 2012 RC?
since working with Visual Studio 2012 RC we get an HttpCompileException when using a class out of an portable class library (.net 4.5 & metro profile) within a razor view.
Exception: (german to ...
31
votes
5
answers
58k
views
App_Start Folder in ASP 4.5 only in WebApplications Projects?
I have a Website Project I've converted to .NET 4.5. I'd like to use the AuthConfig that I've seen added to the App_Start directory. A couple of questions.
Is the App_Start directory only available ...
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
4
answers
31k
views
How to register .Net 4.5.1 with IIS8 on windows 10
How to register .Net 4.5.1 with IIS8 on windows 10 machine?
it used to be simple as running command "aspnet_regiis -i"...but not anymore. if try to run this command i get error
This option is not ...
24
votes
2
answers
7k
views
HttpContext.Current.Items after an Async operation
Consider the following ASP.NET Web API Delegating Handler:
public class MyHandler : DelegatingHandler
{
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage ...
23
votes
2
answers
26k
views
authentication and authorizing in ASP.NET MVC 5
Asp.net MVC 5 seems to have left behind using the AuthorizeAttribute class where you could create a custom authorize attribute by implementing the AuthorizeAttribute class, override its methods and ...
21
votes
2
answers
32k
views
Is System.Web.Optimization part of .Net Framework 4.5?
I've been using Microsoft.Web.Optimization package for some time via the Visual Studio 2012 trial. I was thinking that the Optimization Namespace would be part of .NET 4.5 as stated here.
However, I ...
20
votes
13
answers
87k
views
Failed to load viewstate. The control tree into which viewstate is being loaded
I am receiving the following error message after an HTTP POST on an ASP.NET form hosted inside a UserControl:
Failed to load viewstate. The control tree into which viewstate is being loaded must ...
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 ...
13
votes
2
answers
595
views
Is `_[....]` a valid identifier?
I've just installed the .NET 4.5 reference source from Microsoft as I'm trying to debug an issue I'm seeing and I stumbled across the following in HttpApplication.cs.
// execution step -- call ...
12
votes
2
answers
10k
views
HTML table tag with col, colgroup, tbody, and thead throws compile error in Visual Studio 2010 and Visual Studio 2012
I have a .NET 3.5 web site with a table tag that contains col, colgroup, tbody and thead tags. This is a server side tag with the runat="server" attribute. This table was working fine in Visual ...
12
votes
2
answers
8k
views
What's the difference between these approaches to reference bundled CSS in ASP.NET Web Forms 4.5?
I used Visual Studio 2012 and the built-in template (under Add -> New Project) to create a brand new ASP.NET Web Forms web application project targeting .NET Framework 4.5. Inside the Site.Master page ...
11
votes
1
answer
911
views
Random Invalid Viewstate Error
I know there are a lot of questions on this topic and I have read them all.
I'm using IIS8, .Net 4.5.
Users randomly get an invalid viewstate error, I can't figure it out. Once this happens the only ...
11
votes
1
answer
22k
views
.NETFramework,Version=v4.5 framework is a higher version than the currently targeted framework ".NETFramework,Version=v3.5"
I created my first project in Framework 3.5 and i converted to framework 4.5 and its working perfectly. Secondly i tried to add the reference of this project to another project which is created in ...
10
votes
5
answers
6k
views
Return JWT Token generated by OAuthAuthorizatioServer from controller in Web API
Following @Taiseer Joudeh I was able to create simple POC of Web API. I'm able to create new account, then log-in and call secure Web API when I add JWT token to header.
I'd like to modify method ...
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
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
2
answers
6k
views
ASP.NET 4.5 A potentially dangerous Request.Form value was detected from the client
I have a WYSIWYG editor embedded on a user control that obviously goes into a web page. When I submit the page, I am getting the "A potentially dangerous Request.Form value was detected from the ...
9
votes
1
answer
2k
views
ASP.NET Requests and .NET 4.5 - Strange Behavior
We are getting some strange behavior on our site after upgrading the product to .NET 4.5. I will try to be as specific as possible but the problem is vague, so please bear with me. Also, for this ...
8
votes
4
answers
3k
views
How do I stop using ASPNETDB.MDF in LocalDB?
I implemented ASP.NET Identity and it automatically created ASPNETDB.MDF and aspnetdb_log.ldf in my App_Data folder. I already have the AspNet tables (i.e., AspNetRoles, AspNetUsers, etc) in my SQL ...
8
votes
3
answers
6k
views
Dependency on the framework assembly "System.Runtime, Version=4.0.10.0," which could not be resolved in the currently targeted framework
TFS 2013 - Build: ASP.Net 4.5.1 website I get this error:
warning MSB3268: The primary reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll"
could not be resolved because it has an indirect ...
8
votes
2
answers
3k
views
What is the RequiresValidationContext property of ValidationAttribute class for?
With .NET Framework 4.5, the ValidationAttribute class now has a new Boolean property named RequiresValidationContext.
I have been digging for long time now and I couldn't find what this property is ...
8
votes
2
answers
5k
views
SignalR on mobile web?
I'm evaluating SignalR technology for use in our new product (mobile web application for the broad audience, among other things it needs a real-time chat on some pages).
I've followed the guide to ...
8
votes
1
answer
5k
views
RequestSecurityToken using windows credentials and .net 4.5 WIF
Can anyone point to sample code for actively issuing a RequestSecurityToken using the NT credentials of the Thread.CurrentPrincipal as ClaimsPrincipal?
The scenario is an asp.net web app with ...
7
votes
2
answers
1k
views
Target .net 4.5 but deploy to .net 4.0 is it possible?
I have to work under the following policy "all software must be 1 version behind", I don't particularly like this and I cant change it. so that would mean that our production machine will only go as ...
7
votes
1
answer
5k
views
What is the difference between Application_AuthenticateRequest and FormsAuthentication_OnAuthenticate
I've been experimenting with custom ASP.NET forms authentication and something that confuses me is where to set what roles are associated with a user. Reading various tutorials I've seen suggestions ...
7
votes
2
answers
2k
views
async void event handlers - clarification?
I'm trying to understand the reason why is it bad to do: (notice, context here is asp.net, regardless the plain reason that async void can't be tracked)
public async void Page_Load(object sender, ...
7
votes
2
answers
7k
views
Mixing Windows and Forms authentication in .NET 4.5: how to keep Request.IsAuthenticated = false until after forms authentication ticket is created?
UPDATE:
I solved this problem with just a few fairly simple changes, see my self-answer below.
ORIGINAL QUESTION:
I have an ASP.NET web app that uses both Windows authentication and Forms ...
7
votes
3
answers
3k
views
ASP.NET EventValidation fails when .NET 4.5 Framework is installed in only one server behind the load balancer
We have installed .net 4.5 Framework in one of our web servers. Our applications are targeted for .net 4.0 and run off multiple servers behind a load balancer.
After the installation we get the ...
7
votes
2
answers
6k
views
ASP.NET Resources (resx) doesn't work after migration to .NET 4.5
a installed Visual Studio 2012 and migrate my Web Apps to .NET 4.5.
I had many resx files in App_GlobalResources and always it works.
After migration resx files generates in designer "namespace MyApp....
7
votes
0
answers
646
views
Integrated Pipeline mode: Uploading file of more than 2GB
Though I have set the limit of contentlength to around 4GB which is max as below
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295">
...
6
votes
2
answers
2k
views
.net 4.6 framework is inplace upgrade then how is the .net framework 4.5 works in vs2015?
.net 4.6 framework is inplace upgrade then how is the .net framework 4.5 works in vs2015? I see only one folder v4.0.30319 . How is the dll stored and where ?
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
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
2
answers
383
views
Possible unintended reference comparison worked as intended
I have code similar to the following:
this.Session[key] = "foo";
if ((this.Session[key] ?? string.Empty) == "foo")
{
//do stuff
}
This, of course, creates a "Possible unintended reference ...
6
votes
2
answers
960
views
IE scrambles script in IIS7 with static compression turned on
I am having issues with javascript files not decompressing in IIS7 and stylesheets not loading properly.
I can fix this issue by turning off Static compression in IIS but this can't be a permanent ...
6
votes
4
answers
3k
views
Creating a dynamic zip of a bunch of URLs on the fly
I am trying to create a zip file of any size on the fly. The source of the zip archive is a bunch of URLs and could be potentially large (500 4MB JPGs in the list). I want to be able to do everything ...
6
votes
0
answers
798
views
UnobtrusiveValidationMode set to WebForms forces Postback?
I'm using WebForms Web Application (not MVC).
Is there any reason why when I have this appSetting set to "WebForms" that it forces a postback for validation instead of catching the missing required ...
6
votes
2
answers
3k
views
.NET 4.5 HttpTaskAsyncHandler upload a file
I am trying to work out how to use the new asp.net 4.5 async handlers as well as the Request.GetBufferlessInputStream to write a image upload out to disk. This code runs and it writes a file out but ...
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
5k
views
Async method in Global.asax
I have to call some async methods in the Application_PostAcquireRequestState method of my Global.asax (these methods comes from a library and there's no equivalent sync method for these operations). I ...
5
votes
2
answers
2k
views
First request to IIS site always produces 500.21 error
I believe this is the reason the 'Application Initialization' module does not work, as it appears the server does not bother to spin anything up until the first request, causing it to fail.
The error ...
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
609
views
Dynamic UpdatePanels and UserControls issue
Have come across an interesting issue in ASP.Net WebForms when migrating a project from 3.5 up to 4.5.
The site in question is extremely dynamic - the page is built up based on configuration in a CMS ...
4
votes
4
answers
5k
views
Is it possible to use ASP.NET application caching in web API?
For example, in a ASP.NET page you would do something like
Cache.Add({...}) and access it via Cache["key"]. In this context, Cache is the System.Web.Caching.Cache object.
Is there anyway to do this ...
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
3
answers
11k
views
Request.InputStream is empty when service call is made
I'm working on an ASP.NET 4.5 application and I've encountered a very annoying issue. After migrating to VS2012 we encountered the same issue as here. The given solution worked, however I've now ...
4
votes
1
answer
1k
views
Strategy for Managing Long-Running Tasks in ASP.NET Web Forms
We have some logic to calculate an expensive value per user for our ASP.NET Web Forms application. Currently it sits in the Page_Load header user control that is on every page like this:
//note that ...
4
votes
1
answer
1k
views
Assembly compiled in older .NET version running in newer .NET version, will behavior change?
I have an assembly that is compiled with .NET 3.5. I cannot recompile it in .NET 4.5 since it is used in other applications that are still running .NET 3.5. When I use the assembly in my apps that ...
4
votes
2
answers
1k
views
AdBlock blocking CSS and Images on .NET 4.5 web site
I created a new web site using the default web-forms web site template that comes with Visual Studio 2012. Just went to File--> New Website --> C# --> Asp.Net Web Site, and let it create it's basic ...