25 Sep 2015

Note to Self: Newer IE versions don’t like self signed certs

Mobile No Comments

MSEdgeLOGOWhen newer versions of IE won’t let you forcibly accept an SSL cert, only allowing you to close the tab, here’s an answer that’s working for me here: https://social.technet.microsoft.com/Forums…

1. Go to “run” -> gpedit.msc
2. Under Computer configuration -> Administrative Templates -> Windows Components -> Internet Explorer -> Internet Control Panel
3. Under Prevent ignoring certificate error (set to disable even though it’s set to undefined).

This is helpful if you are accessing devices that use SSL right out of the box. Normally, I’d use Chrome or another browser, but sometimes you run into something that’s IE specific… like an older Dell IPMI interface, or the like.

15 May 2015

A formula for a great vacation

Mobile No Comments

Spend a little extra. Travel with friends you enjoy just hanging out. Rent a house and (importantly), hire a chef. Make sure your chef cooks dinner on your last night there. When you arrive, no matter who made what effort or paid for this or that, draw straws for rooms. Hire a driver from the airport to your house rental. Tip the driver to help you grocery shop. Pack condiments from where you live; they taste different in other places. Have activities for genders, couples, and the group. (golf / spa, day trip romantic getaways, dinner / music for group).

We’ve applied this formula in many, many places and always have a great time. Four couples seems to be the magic number for us.

VRBO is a great place to find houses to rent, but be very careful of the location. Google earth is your friend. Always check with references if you can. Spending more can really make your vacation a once in a lifetime experience.

Would you spend $200 a night at a 5 star hotel? Split that 8 ways and get a luxurious house!

May I suggest: http://www.vrbo.com/3908373ha

 

villa palmilla

We’ve stayed in a villa in that same place – it was amazing. Some of the beaches are great – but it’s the whale watching, dining, and boating that make it great. It’s a 1.5 hour charter from Cabo San Lucas; which is a cool way day trip.

It’s about a four hour flight from Dallas / Ft. Worth Texas.

We tend to plan very little because it seems you never know the mood when you hit the ground. Shopping or some paid excursion may sound awesome until the vibe of the pool and the breakfast drinks set the pace for the day.

Our formula is to never schedule in advance, just check it out when we get there. Usually, by noon – we’re all having fun doing whatever that it’s the experience with friends that makes the trip.

08 Dec 2014

AngularJS $http.post and OPTIONS verbs with C# MVC apps

development 2 Comments

If you have an angular service that posts data, the $http object will do a pre-flight OPTIONS request to the URL to make sure it can post.

1 $http.post('/someUrl', {msg:'hello word!'}). 2 success(function(data, status, headers, config) { 3 console.log(data); 4 }). 5 error(function(data, status, headers, config) { 6 console.log('error'); 7 });

On the flip side, don’t expect IIS to respect this.

In attempts to do this with AngularJs and the ionic framework, I was getting 404’s when calling post and nothing made any sense. Chrome debugging showed the OPTIONS call happening in Network.

After gnashing of teeth (aka googling) – I found the solution on Jef Claes’ blog.

Effectively, you have to obviously allow the OPTIONS verb, but there are two approaches he offers.

A granular, less elegant solution; handing it in controller. To do this, you’ll need to namespaces:

System.Net & System.Net.Http.

In my use case, I have a controller for various API requests, instead of a single controller for all API.

1 [AcceptVerbs("OPTIONS")] 2 public HttpResponseMessage ApiVerbName() 3 { 4 var resp = new HttpResponseMessage(HttpStatusCode.OK); 5 resp.Headers.Add("Access-Control-Allow-Origin", "*"); 6 resp.Headers.Add("Access-Control-Allow-Methods", "GET,DELETE"); 7 8 return resp; 9 }

Great, but then not so great, so the other option Jef details is a HTTP message handler.

In this approach, you create a new class, inherit from DelegatingHandler .  This is Jef’s example, exactly.

1 public class OptionsHttpMessageHandler : DelegatingHandler 2 { 3 protected override Task<HttpResponseMessage> SendAsync( 4 HttpRequestMessage request, CancellationToken cancellationToken) 5 { 6 if (request.Method == HttpMethod.Options) 7 { 8 var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); 9 10 var controllerRequested = request.GetRouteData().Values["controller"] as string; 11 var supportedMethods = apiExplorer.ApiDescriptions 12 .Where(d => 13 { 14 var controller = d.ActionDescriptor.ControllerDescriptor.ControllerName; 15 return string.Equals( 16 controller, controllerRequested, StringComparison.OrdinalIgnoreCase); 17 }) 18 .Select(d => d.HttpMethod.Method) 19 .Distinct(); 20 21 if (!supportedMethods.Any()) 22 return Task.Factory.StartNew( 23 () => request.CreateResponse(HttpStatusCode.NotFound)); 24 25 return Task.Factory.StartNew(() => 26 { 27 var resp = new HttpResponseMessage(HttpStatusCode.OK); 28 resp.Headers.Add("Access-Control-Allow-Origin", "*"); 29 resp.Headers.Add( 30 "Access-Control-Allow-Methods", string.Join(",", supportedMethods)); 31 32 return resp; 33 }); 34 } 35 36 return base.SendAsync(request, cancellationToken); 37 } 38 }

Lastly – register it in the config:

GlobalConfiguration.Configuration.MessageHandlers.Add(new OptionsHttpMessageHandler());

 

I’m posting this so I won’t lose it and in hopes it is easier to find for someone else.

Good luck!