Using ASP.NET session with Fiddler.

There are many developers nowadays using Fiddler to interact with api’s, it’s really a neat tool, if you’re not using it, you should, here is the link. The thing is when you are using asp.net session for authenticate the request it gets messy, fiddler does not send anything regarding session on its own, so the request might return 401 – Unauthorized if you’ve handled things correctly, or just a 500 – Internal Server Error.

Image

 

Now hit the same url with the browser and it will return a 200 – OK, click the yellow “[ Raw” link and you will see the cookie data, copy that.

Image

Now make a request adding that line, and your request will return 200 – OK:

Image

 

Solve black screen right after login

Okay, so windows 8 with avast, or nvidia card and avast are a very bad combination, so you did the same as me and that flipped up your laptop? Join the club, follow these easy steps:
Boot up in safe mode, remember the F8, SHIFT F8 are lies, I’ve spent like 30 mins of my time trying to get it to work… guess what? It didn’t. So place your windows 8 installation media and boot from that drive, windows isn’t clever enough to show you the repair option if you didnt tell it that you’re going to install windows, so nice. In short: Install Windows, Repair, Troubleshoot, Advanced, Command Prompt, then type:

bcdedit /set {default} safeboot minimal
bcdedit /set {default} safebootalternateshell yes

With that done, reboot your pc until a command prompt appears, then most websites will say to do something like this on a command prompt:

wmic
product get name
product where name="productAsListed" call uninstall

But instead of doing that, because in my case avast wasn’t listed and I didn’t want to learn that wmic script stuff, so I gave it a shot, and remember back in the day where you boot your pc, then in the command prompt you type win.exe, and windows 3.1, 3.11 started loading, for short: on your command prompt type:

explorer.exe

Windows will load the ui, then you can uninstall avast, or do any other thing you might want/need. When finished you need to type this command to remove the safeboot flag:

bcdedit /deletevalue {default} safeboot

A word of advice, when using bcdedit be sure that your command was successfully.

Regards,
Esteban.

ExpandoObject

System.Dynamic appeared on .NET 4, with it, appeared the dynamic keyword on C# “which enables the operations in which it occurs to bypass compile-time type checking. Instead, these operations are resolved at run time“.

Since C# was not a dynamic language such as javascript, there were some things we couldn’t do, in javascript we can add properties, methods to an existing object on the fly, but back in the days, that wasn’t an option for C#.

Apparently Microsoft understood that any language has to have some sort of dynamic behavior, so they came up with a new namespace and keyword.

Now we could do this:

    dynamic p = new ExpandoObject();

    p.name = "Esteban";
    p.yearOfBirth = 1984;

    p.calculateAge = new Func<int>(
        () => DateTime.Now.Year - p.yearOfBirth);

    p.celebrateBirthday = new Action(
        () => p.age = p.calculateAge() + 1);

First of all you must use dynamic keyword when dealing with ExpandoObject class otherwise you will get a compiler error “‘System.Dynamic.ExpandoObject’ does not contain a definition…“.

This is nothing new, in fact this was released on April 2010, but still I think it worth mentioning it.

Regards,
Esteban.