Questions tagged [asp.net-4.0]

This tag refers to the version 4.0 of the ASP.NET web application framework introduced with the .NET Framework 4.

Refers to the version 4.0 of the ASP.NET web application framework introduced with the .NET Framework 4.

1371 questions
14
votes
7 answers

How should I perform a long-running task in ASP.NET 4?

I am building a website using .NET 4. There are lots of MSDN articles dating from 2003, about using Thread objects and 2007, using Asynchronous Pages in .NET 2, but that is all pretty stale. I know .NET 4 brought us the Task class and some people…
Scott Stafford
  • 43,764
  • 28
  • 129
  • 177
14
votes
3 answers

Get description for HTTP status code

In ASP.NET you can set the Response.StatusCode to for example 404. Should the status line / description always be set? (to in this case "404 Page Not Found") How do you get the description if you only have the code (404)? Is this somewhere in the…
jaap
  • 163
  • 1
  • 1
  • 5
14
votes
3 answers

FormsAuthentication.SetAuthCookie throwing NullReferenceException in async action

I am finding that FormsAuthentication.SetAuthCookie is throwing a NullReferenceException - Object reference not set to an instance of an object inside an async action on an azure website. I found the…
Tom
  • 12,591
  • 13
  • 72
  • 112
14
votes
3 answers

ASP.NET 1.1 to 4.0 migration: events not working

I've recently begun migrating an ASP.NET project from .NET version 1.1 to 4.0. This system currently runs on customer site and works. When I migrate the solution via the VS wizard, I don't get any errors. The error is that no server control events…
Jan Kratochvil
  • 2,307
  • 1
  • 21
  • 39
13
votes
3 answers

ASP.NET 4.0 URL Routing HTTP Error 404.0 - Not Found

I have implemented URL routing in ASP.NET 4.0 using following route. routes.MapPageRoute( "NewsDetails", // Route name "news/{i}/{*n}", // Route URL "~/newsdetails.aspx" // Web page to handle route ); which gives me…
Pragnesh Patel
  • 1,444
  • 3
  • 23
  • 38
13
votes
5 answers

Stopping XSS when using WebAPI

I have a controller which accepts public class MyModel { [MaxLength(400)] public string Message { get; set; } } I have a WebApi Post Action public HttpResponseMessage Post(MyModel viewModel) { if (!ModelState.IsValid) …
Tom
  • 12,591
  • 13
  • 72
  • 112
13
votes
3 answers

Preventing a deadlock when calling an async method without using await

I need to call a method returning a Task from within public override void OnActionExecuting(ActionExecutingContext filterContext) It wont let me make this method async it throws the following An asynchronous module or handler completed while an…
Tom
  • 12,591
  • 13
  • 72
  • 112
12
votes
5 answers

Download Multiple Files Without Using Zip File

I have a generic handler Document.ashx that creates Word documents on the fly by reading information from the querystring like this Document.ashx?clientid=123&documentid=10 and it works perfectly. I need to create an interface with a list of…
Greg
  • 8,574
  • 21
  • 67
  • 109
12
votes
1 answer

Maximum Length of FormsAuthenticationTicket.UserData Property

I am implementing a Custom Identity class for an ASP.Net 4.0 site with Forms Authentication based on this tutorial: Forms Authentication Configuration and Advanced Topics I would like to store extra user information (First/Last Name, Gender,…
Greg
  • 8,574
  • 21
  • 67
  • 109
12
votes
4 answers

'compilerVersion' attribute in the provider options must be 'v4.0' or later

Getting this error: The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or …
NealWalters
  • 17,197
  • 42
  • 141
  • 251
12
votes
1 answer

Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode?

After pulling my hair out for the last three days in my first non-upgraded ASP.NET 4.0 Web Application, I stumble across this post explaining it all. http://jai-on-asp.blogspot.com/2010/06/changes-and-differences-between-aspnet.html under the…
RichC
  • 7,829
  • 21
  • 85
  • 149
12
votes
3 answers

"An entry with the same key already exists" appears when compiled under .NET 4

I am trying to upgrade an ASP.NET application to .NET 4, but one page on my site contains an exception: Argument Exception: an entry with the same key already exists". What is different about ASP.NET 4 that might cause this problem? One…
Tom
  • 12,776
  • 48
  • 145
  • 240
12
votes
2 answers

How to add users in IIS Manager for an ASP.NET 4.0 application?

I have installed an ASP.NET 4.0 Web forms application in IIS 7.5. If I set the application pool to DefaultAppPool (.NET Framework 2.0) I get the icons for Providers, .NET-Roles and .NET-Users displayed on the configuration page for the application…
Slauma
  • 175,098
  • 59
  • 401
  • 420
12
votes
2 answers

asp.net 4.0 web forms routing - default/wildcard route

I there a simple way when using ASP.NET 4.0 routing with Web Forms to produce a route that will act as some kind of wildcard? It seems to me that within WebForms, you have to specify a route for every page - I am looking for some kind of generic…
Martin Robins
  • 6,033
  • 10
  • 58
  • 95
12
votes
1 answer

LazyList vs System.Lazy> in ASP.NET MVC 2?

In Rob Conery's Storefront series, Rob makes extensive use of the LazyList<..> construct to pull data from IQueryables. How does this differ from the System.Lazy<...> construct now available in .NET 4.0 (and perhaps earlier)? More depth based on…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287