Recent Comments


re: Using plUpload to upload Files with ASP.NET
Thursday @ 5:29pm | by Rick Strahl

@Ersin - That should work. All files are passed through, and filtered with the extension filter list so I'm not sure why this wouldn't work. The data coming up is just raw data - is it possible that there's some client side restriction? I haven't used this in a while maybe something's changed?
re: Using plUpload to upload Files with ASP.NET
Thursday @ 6:55am | by Ersin

Hello Rick, thanks for your well-documented sample. I want to upload files except images. (zip,rar). I changed filters but it didn't work. How can i change this extensions ? Or can i :)

Thanks
re: Mixing $http Promises and $q Promises for cached Data
Tuesday @ 8:33am | by Torgeir

Hm..I don't think there will be any performance issues since Angular services are singletons and you will always be interacting with the same cached promise and calling the same then() method over and over again - passing in a regular callback for it to execute. The down side though is that every caller has to interact with it as a promise every time which means more code than just grabbing a resolved data value....

I go back and forth about caching promises vs the returned data value though.
It is definitely easier to grab a data value if you know your app is in a state where the initial promise is guaranteed to be resolved (e.g. after login in etc)
re: Mixing $http Promises and $q Promises for cached Data
Tuesday @ 1:28am | by Rick Strahl

@Torgeir - interesting approach and yes that would work I suppose. Never thought about caching the actual Promise instance... Wonder if that would have performance implications as you would hook up new handlers to the promise for each access.
re: Mixing $http Promises and $q Promises for cached Data
Monday @ 4:11am | by Torgeir

Can't you just do something like the following:

var myPromise = null;

function getAlbums() {
if (myPromise == null)
myPromise = $http.get("/someUrl").then(function (res) {
return res.data;
});
return myPromise;
}

Generally I try to avoid resolving promises in the service, but for caching it does make sense.

re: Mixing $http Promises and $q Promises for cached Data
December 14, 2014 @ 11:35pm | by Rick Strahl

@Alexander - totally agree that $http's special interface was a bad idea in that it goes against all other promises produced in Angular or otherwise. At the very least they should have exposed the .then() method with a senisible signature, but unfortunately that's not the case (.then()'s success method returns an internal object rather than the result data).

While I agree I also think that turning everything into proper promises adds extra overhead when you do use $http as you have to wrap the existing promise into another promise (ie. another extra indirection and of course extra code) and it also goes against the standard guidance for use of $http that you have to be sure to document so there are no surprises.
re: Mixing $http Promises and $q Promises for cached Data
December 14, 2014 @ 10:46pm | by Alexander Pavlyuk

As for me I prefer the opposite approach. We usually have a lot of async stuff in our js apps. And for angular there's $q service to make promises. But $http promise is different in that it produces promises with success() ans error() "helper" functions. I strongly disagree in that this exception to common interface is helping. Maybe ng devs added those functions for beginners that often use jQuery and don't like to read docs... I always wrap $http calls in $q promises inside my services and expose the latter ones to other modules. This unification is reasonable: if any other ng developer uses my modules, he will just read that my module has a list of functions that return $q-compatible promises and that's it.
re: AngularJs ng-cloak Problems on large Pages
December 10, 2014 @ 10:46pm | by Torgeir

Sounds like you have your solution, but I how about this approach?

I have found that for large DOMs it often makes sense to use ng-if to toggle content. The ng-if directive appears similar to ng-hide/show, but with the important difference that it physically removes the actual DOM elements rather than hiding them using styles. My experience is that you can trim your DOM a lot this way. Also, another added benefit is that you don't incur watches on the ng-if excluded content like you would with the ng-show approach.

I have some more info in an article I wrote a while back:
http://www.syntaxsuccess.com/#/viewarticle/547a8ba2c26c307c614c715e

You make a good point by saying that it's easier to control permission based content by returning it from the server. However, I would argue that the same could be accomplished by having your angular application talk to a data api with server side permission checks instead. One idea would be to move away from an mvc, view based application, and instead talk to a web api service that returns json based on user permissions in tandem with ng-if.

Anyway, not sure if this is useful, but just a thought.
re: AngularJs and Promises with the $http Service
December 10, 2014 @ 1:36pm | by Rick Strahl

@Thijs - thanks. Fixed in the article.
re: Rendering ASP.NET MVC Razor Views outside of MVC revisited
December 10, 2014 @ 1:29pm | by Rick Strahl

@Vignesh - No, you have to render the top level view. But it sounds to me that you can do what you want if you do the proper segmentation of your views using partial views rather than sections (or else embed the sections into partial views).
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
December 10, 2014 @ 12:35pm | by Rick Strahl

@Mike - I actually do the same. In fact every Web site I run is hooked up to a monitor that checks whether the site is running and notifies me of failures and it doubles as the ping mechanism.

The ping check in the code above is just a last ditch fail safe. With Application Initialization there's only one scenario where that's required and that's for AppDomain shutdowns. All other scenarios Application Initialization handles for restarting the service and keeping it running (ie. crashes, restarts).
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
December 10, 2014 @ 8:12am | by Mike Moorman

This self-ping mechanism with internally running threads is an antipattern. I've been down this path too, and generally the symptom is when we find ourselves trying to do timed or schedule-oriented tasks in Application_Start or Application_End.

The iron-clad best practice is to have an external process connect to the web service or web site on a schedule, say, every minute, with the following caveats:

* The application uses a http handler to handle the ping request
* The application only honors requests from localhost

I have a windows service that I use for this purpose. It's installed on every web server where I want this behavior. I've taken it a bit further actually, using the ping as a status reporter, and each site can return whatever metrics are relevant, to the windows service pinging it.
re: IIS SSL Certificate Renewal Pain
December 09, 2014 @ 10:09pm | by ShaneF

Holy cow you were a life saver here! I'm in the same boat. I only deal with client cert issues once every year or so. This was a life saver! Especially adding the portion on how to link the new cert with the website. Thank you!
re: Calling JavaScript functions in the Web Browser Control
December 09, 2014 @ 9:17am | by Peter E.

Hi,
I read this thread with interest, but I have one big concern.
All this will only work with the Visual Studio Browser Control, therefore the website will be embedded within the forms application.

But my problem is, that I have to find a solution to control a web application provided from an other company. And they won't like to embed their application within a forms app.

I'm seeking for a solution to control a standalone instance of IE 11. I found that with "SHDocVw.dll" and "msthml" I might do this job with this piece of code:

SHDocVw.InternetExplorerMedium IE = null;
IWebBrowserApp wb = null;
 
...
IE = new SHDocVw.InternetExplorerMedium();
IE.Visible = true;
 
...
string URL = txtURL.Text; // text input field with the URL to navigate
wb = (IWebBrowserApp)IE;
wb.Navigate(URL, ref Empty, ref Empty, ref Empty, ref Empty);
 
..
 
mshtml.HTMLDocument _document = (mshtml.HTMLDocument)IE.Document;
object result = _document.parentWindow.execScript("showOverlay();", "javascript");


But I don't get the result from the JavaScript back!
After searching in the web, I found in a Delphi forum that "parentWindow.execScript" doesn't return result codes in any case!

Has somebody a solution for this?

BR
Peter
re: Rendering ASP.NET MVC Razor Views outside of MVC revisited
December 08, 2014 @ 1:16pm | by Vignesh

Rick,

Is it possible to divide a single view into a number of sections and render a given section instead of the entire view ? This will be useful in cases where there are a number of tiny but related html stuff that don't necessarily warrant a dedicated view.

For ex : renderer.RenderSection(View,SectionA, model);
renderer.RenderSection(View,SectionB, model);
etc
re: A jquery-watch Plug-in for watching CSS styles and Attributes
December 05, 2014 @ 6:51am | by Leonhard Ortner

Hello, first off all – THX A LOT for your great Plugin!

But i have a question, is it possibile to trigger the "Sync-Event" manualy? Cause when i dynamically generate a my "Shadow-Element" its out of sync :/

wbr
Leo
re: AngularJs and Promises with the $http Service
December 05, 2014 @ 2:33am | by Thijs

Nice article! "Unreachable code detected" in the first example. It's actually returning the http promise instead of the deferred one. The script on plunker is correct.
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
December 05, 2014 @ 2:08am | by Arunkumar

1)How to set Application Pool Start Mode = Always Running through appcmd..
Ex: Like this "%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00"

2)And also set [preloadEnabled ='true'] through appcmd

3)How to install Application Initialization through appcmd

Because i need to run batch file in my system while hosting my application..
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
December 05, 2014 @ 1:57am | by Arunkumar

1)How to set Application Pool Start Mode = Always Running through appcmd..
Ex: Like this "%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00"

2)And also set [preloadEnabled ='true'] through appcmd

3)How to install Application Initialization through appcmd

Because i need to run batch file in my system while hosting my application..
re: Using FiddlerCore to capture HTTP Requests with .NET
December 03, 2014 @ 10:36am | by Chris

Rick, thanks for the great post, it really helped me. Eric, thanks for the awesome tool. I'm wondering if there is a place I could learn more about the timer? I'm specifically wanting to know how long it takes to 'get a connected to the server' and how long it takes to 'download the file after the connection is established'. In quotes because I'm sure my terminology is incorrect. In other words, which timer objects I would use.
re: Passing multiple simple POST Values to ASP.NET Web API
December 03, 2014 @ 5:19am | by Royi Namir

Now with both x-form-encoded supoort AND JSON send support. ( for POSTS)


https://github.com/RoyiNamir/SimplePostVariableParameterBindingExtended
re: Creating multi-target NuGet Packages with vNext
December 02, 2014 @ 7:53pm | by Rick Strahl

@Daniel - thanks for the link to the analyzer - that'll be useful.

Yeah pretty sure that I had both System.IO and System.IO.FileSystem. But initially I now don't remember whether I just relied on the Intellisense preview or the actual compiler.

I've been seeing really, really weird compilation behavior where a full Rebuild will throw errors, then just a build will work. So maybe I have to rack that up to user error :-) but I could have sworn I had both in there before. It started working today - maybe it was one of the builds of the day that had some weird issue?
re: Creating multi-target NuGet Packages with vNext
December 02, 2014 @ 6:34pm | by Daniel Plaisted

When porting code to .NET Core, I'd suggest using our .NET Portability Analyzer to determine which APIs aren't supported in .NET Core, and in common cases what you can replace them with: http://blogs.msdn.com/b/dotnet/archive/2014/08/06/leveraging-existing-code-across-net-platforms.aspx

I'm not sure why StreamReader and StreamWriter weren't working for you. Are you sure the reference to the System.IO package was working correctly?

For the File class (and hence the File.AppendText method), you need to reference the System.IO.FileSystem package.
re: Creating multi-target NuGet Packages with vNext
December 02, 2014 @ 7:47am | by Khalid Abuhakmeh

"It’s a bit odd that StreamWriter is not working. In fact most of the stream related classes in System.IO don’t appear to be there. It makes me think that either I’m missing a package or this is still under heavy construction by Microsoft."

Yeah... tell me about it. I ran into this and basically couldn't go much further with core. Also there is not way to convert an array of bytes back into an object with Core from what I've seen (so far). There is a lot still churning and probably worth waiting out, but the impulse to use the new and shiny is so powerful.
re: AngularJs ng-cloak Problems on large Pages
December 02, 2014 @ 12:23am | by Rick Strahl

@Alex - works for me with Angular 1.3.3. I don't see why it wouldn't work - it's just CSS you're setting.
re: AngularJs ng-cloak Problems on large Pages
December 02, 2014 @ 12:21am | by Rick Strahl

@Alex - works for me with Angular 1.3.3...
re: Updating Assembly Redirects with NuGet
December 02, 2014 @ 12:20am | by Rick Strahl

@Clay - NuGet only works off a single package and updates redirects only for that single package, it doesn't look at all of the dependencies when it installs individual packages. This command looks at the whole project/solution and looks at all assembly references. I think the reason it doesn't happen on everything is that this can also potentially break stuff if you explicitly set assembly redirects or if you want to stick with a particular verions for a given assembly.
re: Updating Assembly Redirects with NuGet
December 01, 2014 @ 8:46am | by B. Clay Shannon

So why isn't this just automatically done? Is there any reason why you wouldn't want this?
re: AngularJs ng-cloak Problems on large Pages
December 01, 2014 @ 8:11am | by Alex

style="display:none"
doesn't work for modern versions of AngularJs
re: A WebAPI Basic Authentication Authorization Filter
December 01, 2014 @ 12:59am | by budy

Thanks for the Example. Just wanna Ask,

what is the Bbest way to use custom header using "Authorization" if im using JWT

xhr.setRequestHeader("Authorization","JWT " + btoa("username" + ":" + "password"));
re: Using FiddlerCore to capture HTTP Requests with .NET
November 30, 2014 @ 11:49am | by Rick Strahl

@Ted - you can't auto-install certificates. This is a Windows feature that requires user authorization to prevent malicious installation of man in the middle certificates. So you just have to pre-install the certificates on your test servers.
re: Using FiddlerCore to capture HTTP Requests with .NET
November 30, 2014 @ 1:32am | by Ted Yang

Hi Rick,

Thank you for your reply. Yes, as you said it's one time, after I install the cert with makecert.exe, it works. My problem is that our team make the test run on multiple robots, and the robots could auto scale out, then the new created VMs may not have the cert. That's why I want to make everything automated.
re: Updating Assembly Redirects with NuGet
November 29, 2014 @ 12:50pm | by Jon Atkinson

Hi Rick,

I also had this problem and spent a few hours resolving it.

This nuget command would've sorted it in no time. And, now I know how ;-)

Thanks for posting.
re: Dell XPS 15 review
November 28, 2014 @ 10:46pm | by Ade

Super review, although i would use the native resolution @100% font magnification.
re: ASP.NET Web API and Simple Value Parameters from POSTed data
November 28, 2014 @ 2:26pm | by Rick Strahl

@Vicky - you can use something like this:

[HttpPost]
public async Task<string> PostRawBufferManual()
{
    string result = await Request.Content.ReadAsStringAsync();            
    return result;
}


You can find a lot more info on the issue and why it's designed that way in Web API in the "Accepting Raw Request Body Content with Web API" post:

http://weblog.west-wind.com/posts/2013/Dec/13/Accepting-Raw-Request-Body-Content-with-ASPNET-Web-API
re: ASP.NET Web API and Simple Value Parameters from POSTed data
November 28, 2014 @ 3:46am | by vicky

@Rick
its owesome..
Can we load whole message body into controller's method paramter?

for example:
I am posting xml:
<Search>
<Criteria>
<KeywordValue>computer</Keyword>
</Criteria>
<SearchType>Keyword</SearchType>
</Search>


I am trying to load this xml in a string parameter of my controller method:

void PostMethod(search abc)
{
}
re: Using FiddlerCore to capture HTTP Requests with .NET
November 27, 2014 @ 7:14pm | by Rick Strahl

@Ted - One time when the cert is created you get the dialog but after this not anymore. So I suggest you add the certificate to your machine, then your test should just work with SSL.

Code in the article shows you how you can check whether the cert is already installed and how to install it.
re: West Wind WebSurge - an easy way to Load Test Web Applications
November 27, 2014 @ 7:11pm | by Rick Strahl

@Don - WebSurge doesn't fix up any data. Whatever you see in the Request content area is what gets sent.
re: Using FiddlerCore to capture HTTP Requests with .NET
November 27, 2014 @ 12:03am | by Ted Yang

Hi Rick,

really great topic about using fiddlerCore to capture traffic, I have learned a lot. I'm working on a testing project which use selenium to automate our web test. I also want to use fiddlerCore to capture the traffic and make everything automated. Everything goes well except the "InstallCertificate()", when CertMaker.trustRootCert(), it will popup a window and ask if you want to trust this cert. Do you know there is a way to make this action silent?

Best wishes,
Ted
re: Nuget Dependencies and latest Versions
November 25, 2014 @ 10:00pm | by John Washburn

Is there an options setting to change default from
-DependencyVersion Lowest
to
-DependencyVersion HighestMinor
or
-DependencyVersion Highest
re: Nuget Dependencies and latest Versions
November 25, 2014 @ 9:56pm | by John Washburn

Microsoft and NuGet are so close to providing the same functionality as the CPAN had in 1998. I hope nuget gets to that level of sophistication soon.

What is the point of requiring nuget author to use semantic versioning and then NOT let other nuget package author *rely* on that that semantic versioning.

http://docs.nuget.org/docs/reference/versioning

States:
In brief, these correspond to: * Major: Breaking changes. * Minor: New features, but backwards compatible. * Patch: Backwards compatible bug fixes only.

I agree that if I specify [2.0.0, 3.0.0) then I would think that I am spcifying that the latest non breaking version of 2.x of the nuget package is acceptable to my nuget package.

Requiring the user to specify
-DependencyVersion Highest
is inane.

At the least I should be specify in the nuspec that lowest or highest is preferred and then user can override it on the command line and at their own risk.
re: West Wind WebSurge - an easy way to Load Test Web Applications
November 25, 2014 @ 6:39pm | by Don Wilcox

Rick,

I want to use WebSurge to exercise a SOAP-based service, but the tool is wrapping my SOAP payload in CDATA. Any thoughts about adding the option of not doing this?
re: Self-Hosting SignalR in a Windows Service
November 24, 2014 @ 4:47pm | by VirtualLife

Thanx. Couldn't have built my signalR service without you.

Ran into more issues than I should have, but your signalr tutorials have been extremely helpful.

In case anyone else runs into this, I don't understand why but:
If I use app.Map("", map => everything works as expected, but using
app.Map("/signalr", map => as in the example, it never works. Actually wanted the url without signalr, but lost why it didn't work. Realized this when trying to go to http://localhost:8080/signalr/hubs returned a 503 after changing and doing http://localhost:8080/hubs it worked fine.
re: Using CSS Transitions to SlideUp and SlideDown
November 23, 2014 @ 9:59am | by nonbrake

Hi, you have to add resize function for resizing window then counted outerHeight isn´t correct after window resizing.
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
November 22, 2014 @ 5:34am | by qakmak

1.So How about it when restart the website not application pool?
2.By the way: <add initializationPage="/" /> not working on IIS7.5 WINDOWS SERVER 2008 R2, it not send request event the application pool recycle.
re: Passing multiple simple POST Values to ASP.NET Web API
November 21, 2014 @ 1:12pm | by Royi Namir

NOw with nullable types supports


public class SimplePostVariableParameterBinding : HttpParameterBinding
{
    private const string MultipleBodyParameters = "MultipleBodyParameters";
 
    public SimplePostVariableParameterBinding(HttpParameterDescriptor descriptor)
        : base(descriptor)
    {
    }
 
    /// <summary>
    /// Check for simple binding parameters in POST data. Bind POST
    /// data as well as query string data
    /// </summary>
    /// <param name="metadataProvider"></param>
    /// <param name="actionContext"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider,
                                                HttpActionContext actionContext,
                                                CancellationToken cancellationToken)
    {
        string stringValue = null;
 
        NameValueCollection col = TryReadBody(actionContext.Request);
        if (col != null)
            stringValue = col[Descriptor.ParameterName];
 
        // try reading query string if we have no POST/PUT match
        if (stringValue == null)
        {
            var query = actionContext.Request.GetQueryNameValuePairs();
            if (query != null)
            {
                var matches = query.Where(kv => kv.Key.ToLower() == Descriptor.ParameterName.ToLower());
                if (matches.Count() > 0)
                    stringValue = matches.First().Value;
            }
        }
 
        object value = StringToType(stringValue);
 
        // Set the binding result here
        SetValue(actionContext, value);
 
        // now, we can return a completed task with no result
        TaskCompletionSource<AsyncVoid> tcs = new TaskCompletionSource<AsyncVoid>();
        tcs.SetResult(default(AsyncVoid));
        return tcs.Task;
    }
 
 
    /// <summary>
    /// Method that implements parameter binding hookup to the global configuration object's
    /// ParameterBindingRules collection delegate.
    /// 
    /// This routine filters based on POST/PUT method status and simple parameter
    /// types.
    /// </summary>
    /// <example>
    /// GlobalConfiguration.Configuration.
    ///       .ParameterBindingRules
    ///       .Insert(0,SimplePostVariableParameterBinding.HookupParameterBinding);
    /// </example>    
    /// <param name="descriptor"></param>
    /// <returns></returns>
    public static HttpParameterBinding HookupParameterBinding(HttpParameterDescriptor descriptor)
    {
        var supportedMethods = descriptor.ActionDescriptor.SupportedHttpMethods;
 
        // Only apply this binder on POST and PUT operations
        if (supportedMethods.Contains(HttpMethod.Post) ||
            supportedMethods.Contains(HttpMethod.Put))
        {
            var supportedTypes = new Type[] { typeof(string), 
                                                typeof(int), 
                                                typeof(int?), 
                                                typeof(decimal), 
                                                typeof(decimal?), 
                                                typeof(double), 
                                                typeof(double?), 
                                                typeof(long), 
                                                typeof(long?), 
                                                typeof(bool),
                                                typeof(bool?),
                                                typeof(DateTime),
                                                typeof(DateTime?),
                                                typeof(byte[])
                                            };
 
            if (supportedTypes.Count(typ => typ == descriptor.ParameterType) > 0)
                return new SimplePostVariableParameterBinding(descriptor);
        }
 
        return null;
    }
 
 
    object StringToType(string stringValue)
    {
        object value = null;
 
        if (stringValue == null) value = null;
        else if (Descriptor.ParameterType == typeof (string)) value = stringValue;
        else if (Descriptor.ParameterType == typeof (int)) value = int.Parse(stringValue, CultureInfo.CurrentCulture);
 
        else if (Descriptor.ParameterType == typeof (int?)) value = string.IsNullOrWhiteSpace(stringValue) ? (int?) null : int.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (long)) value = long.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (long?)) value = string.IsNullOrWhiteSpace(stringValue) ? (long?) null : long.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (decimal)) value = decimal.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (decimal?)) value = string.IsNullOrWhiteSpace(stringValue) ? (decimal?) null : decimal.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (double)) value = double.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (double?)) value = string.IsNullOrWhiteSpace(stringValue) ? (double?) null : double.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (DateTime)) value = DateTime.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (DateTime?)) value = string.IsNullOrWhiteSpace(stringValue) ? (DateTime?) null : DateTime.Parse(stringValue, CultureInfo.CurrentCulture);
        else if (Descriptor.ParameterType == typeof (bool))
        {
            value = false;
            if (stringValue == "true" || stringValue == "on" || stringValue == "1") value = true;
        }
        else if (Descriptor.ParameterType == typeof (bool?))
        {
            value = false;
            if (string.IsNullOrWhiteSpace(stringValue)) value = (bool?) null;
            else
                if (stringValue == "true" || stringValue == "on" || stringValue == "1") value = true;
        }
        else value = stringValue;
 
        return value;
    }
 
    /// <summary>
    /// Read and cache the request body
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    private NameValueCollection TryReadBody(HttpRequestMessage request)
    {
        object result = null;
 
        // try to read out of cache first
        if (!request.Properties.TryGetValue(MultipleBodyParameters, out result))
        {
            var contentType = request.Content.Headers.ContentType;
 
            // only read if there's content and it's form data
            if (contentType == null || contentType.MediaType != "application/x-www-form-urlencoded")
            {
                // Nope no data
                result = null;
            }
            else
            {
                // parsing the string like firstname=Hongmei&lastname=ASDASD            
                result = request.Content.ReadAsFormDataAsync().Result;
            }
 
            request.Properties.Add(MultipleBodyParameters, result);
        }
 
        return result as NameValueCollection;
    }
 
    private struct AsyncVoid
    {
    }
}

re: Accepting Raw Request Body Content with ASP.NET Web API
November 21, 2014 @ 11:33am | by Rick Strahl

@Rob - You need .NET 4.0 at least.
re: Accepting Raw Request Body Content with ASP.NET Web API
November 21, 2014 @ 11:02am | by Rob

I like it. Can this be done in VS2008 with .NET framework 3.5 or are more current versions required? Thanks
re: GZip/Deflate Compression in ASP.NET MVC
November 19, 2014 @ 11:03am | by Rick Strahl

@Dan - not sure why the bracketing would be required? Headers.Remove() will remove the headers if the value exists, otherwise it does nothing so either way it would work.
re: GZip/Deflate Compression in ASP.NET MVC
November 19, 2014 @ 6:32am | by Dan Napierski

Great article. Thank you.

I had to make the following change to have it work on my development machine:

if (HttpRuntime.UsingIntegratedPipeline)
{
response.Headers.Remove("Content-Encoding");
}