Microsoft Virtual Academy–Upcoming Live Jump Start Events

Lately Microsoft Virtual Academy has been offering cutting-edge courses, not only for the IT folks but also for the developers and QA (especially related to the TFS/ALM).

Check out upcoming live training sessions @


nuget “Access is denied” “Command existed with code 5”

I just setup a new Windows Server 2008 R2 development VM in order to work on a project. Downloaded the source code from Git and hit “Rebuild Solution”. Few projects failed to build with the following error (taken from the Output window after enabling MSBuild verbosity to Detailed:

Task “Exec” “C:\Work\Github\………….\.nuget\nuget.exe” install “C:\Work\Github\…………\packages.config” -source “”  -RequireConsent -solutionDir “C:\Work\Github\…………….\ “

C:\Work\Github\…….\.nuget\NuGet.targets(87,9): error : Access is denied.

C:\Work\Github\…..\.nuget\NuGet.targets(87,9): error MSB3075: The command “”C:\Work\Github\…..\.nuget\nuget.exe” install “C:\Work\Github\…..\packages.config” -source “”  -RequireConsent -solutionDir “C:\Work\Github\…..\ “” exited with code 5. Please verify that you have sufficient rights to run this command.
Done executing task “Exec” — FAILED.

The NuGet executable could not be executed during the build process! I had never faced this problem before. Came across few posts on the Internet where others were facing similar problems and had recommended to change certain NuGet settings or to delete and reinstall NuGet altogether. I did all that but no use.

I manually ran the nuget.exe in a command prompt and got the same “Access is denied” error. All of a sudden, light-bulb moment Smile I looked at the properties of the nuget.exe and that is where the answer was! See below the screen shot.


Perhaps this is Windows Server 2008 security feature but the Everyone was allowed only “Read” permission on the nuget.exe; in order for it to get executed, the caller should have the “Read & Execute” permission as well.

Granting the “Everyone” group “Read & Execute” seems to solve the problem.


I would love to hear if you know of a better way to solve this issue. Drop me a line. Thanks.

ASP.NET 4 and Visual Studio 2010 Web Development Overview

Original Source –

PDF – Download This Whitepaper

Following are few of the important and interesting findings from the above article; there are tons of new features that might of an interest to you. Don’t forget to check out the source article.

Web.Config File Refactoring

Bulk of the content in a web.config have been moved to machine.config hence allowing the web.config in the applications to be literally empty if needed.

Auto-Start Web Applications

    • A new scalability feature named auto-start available when ASP.NET 4 runs on IIS 7.5 on Windows Server 2008 R2
    • It is a controlled approach for starting up an application pool, initializing an ASP.NET application, and then accepting HTTP request
    • “Application Initialization Module” – aka “Application Warm-up Module”
    • Helps administrators improve the responsiveness of the web applications by loading them before the first request arrive
    • This comes built-in IIS 8.0

Permanently Redirecting a Page

    • Instead of using Response.Redirect (which issues HTTP 302 Found) for handling incoming requests to old/stale URLs, use RedirectPermanent (which issues an HTTP 301 Moved Permanently). The later method causes the search engines to store the new URL associated with the content.

Shrinking Session State

    • Session state that is stored across a web-farm could be stored either in session-state service or in SQL Server
    • Since the Session is stored on remote servers hence storing large session state across network or machine boundaries could take some time
    • With ASP.NET 4.0 we now have an option to enable compression on the session state hence reducing the size of the state that needs to be stored and retrieved
    • <sessionState> now supports an attribute named compressionEnabled; which if set to “true” will enable ASP.NET to use System.IO.Compression.GZipStream class to compress the session state

Expanding the Range of Allowable URLs

Version prior to ASP.NET 4.0 constrained the length of the URL path to 260 characters. Not any more! With ASP.NET 4.0 you may increase or decrease the limit as you like by setting the following two <httpRuntime> attributes: maxRequestPathLength and maxQueryStringLength

maxRequestPathLength controls the portion of the URL that doesn’t include protocol, server name, and query string)

maxQueryStringLength controls the length of the query string

Extensible Request Validation

ASP.NET provides request validation checks whether help against the XSS attacks. But sometimes that validation results in too many false positives. Application developers or system administrators had no control over the validation rules resulting in unexpected behavior at times.

With ASP.NET 4.0 the developers can now implement their own request validation logic and plug that into the ASP.NET pipeline! It is a three step process:

  1. Implement a class that derives from RequestValidator class
  2. Override the IsValidRequestString method
  3. Configure the requestValidationType attribute on the <httpRuntime>

Object Caching and Object Caching Extensibility

We all know and love ASP.NET Caching which is provided under the System.Web.Caching namespace. It is so popular that non-web application developers want to use it in their desktop application! It is awkward to say the least to use a web dependent implementation in a Windows desktop application for example.

To address this issue and to make Caching available to non-web applications, .NET 4.0 introduced a brand new implementation of caching which is part of the System.Runtime.Caching namespace (System.Runtime.Caching.dll assembly).

The new MemoryCache class is closely modeled on the ASP.NET Cache hence you will find similar concepts and implementation.

Extensible HTML, URL and HTTP Header Encoding

You may now create custom encoder which ASP.NET will use for the following text-encoding tasks:

  1. HTML encoding
  2. URL encoding
  3. HTML attribute encoding
  4. Encoding outbound HTTP headers

Simply derive a class from System.Web.Util.HttpEncoder and configure it in the httpRuntime section of the web.config file.

Routing in ASP.NET 4

ASP.NET 4 has built-in support for routing with web forms, hence allowing you to configure an application to accept request URLs that don’t map to physical files.

Use the RouteTable.Routes.MapPageRoute method to define a web form route.


With ASP.NET 4.0, you could also use the PageRouteHandler class for mapping routes to appropriate web forms. The following example is equivalent of the above example.


You can use one of the following two properties to get your hands on the data that the routing framework extracted from the URL.

HttpRequest.RequestContext.RouteData and Page.RouteData

Setting Client IDs

The new ClientIDMode property addresses a long-standing issue in ASP.NET. If you have done JavaScript programming against the HTML generated by ASP.NET then you are familiar with this issue. ASP.NET uses an algorithm to generate the controls’ client side id which could change if you happen to change your HTML structure or control ids of the container controls!

With ASP.NET 4.0, the developers have more control over client id generation. The new ClientIDMode property lets you specify how the client ID is generated for controls.

AutoID – Same behavior as earlier versions of ASP.NET – use default algorithm for generating id

Static – This ensures that whatever id developer has provided for the control remains as it is! It is your responsibility to ensure that the control ids are unique.

Predictable – This option is primarily used in data controls that use repeating controls. It concatenates the ID properties of the control’s naming containers, but generated client ID values don’t contain strings like “ctlxxx”.

Inherit – This setting is the default for controls; it specifies that a control’s ID generation is the same as its parent.

This property could be set both at the Page level or the control level.

Setting this property at the Page level defines default value for all controls in the current page. The default Page level value for this property is AutoID. The default control level value for this property is Inherit.

Therefore if you don’t specify this property anywhere in the code, it defaults to AutoID for every control hence exhibiting same behavior as earlier versions of ASP.NET.

This property can also be set at the computer-level or at the application level!