.NET, Basic Auth, 401 & … 301?

So that 30+ day thing got put on hold. Extended hold.

Anyway…

For a little while now I’ve been wanting to store some minor data files on my site behind a little “Basic Auth” wall, but I’ve been put-off because I couldn’t pull the files down with some simple .NET code. I would ALWAYS get a 401 response. Stupid Basic Auth, and stupid .NET and their weird authentication-mechanisms in HttpWebRequest objects, right?

I had previously tried passing along a NetworkCredentials object, or setting PreAuthenticate to true, or adding the Authorization header manually, or trying all three, or any combination thereof. Didn’t matter. Every. Damn. Time: (401) Unauthorized. So, that project got put on hold until today: I was determined to figure it out. I searched the web, I followed 12 or so links. Tried all of those things over again. All of it failed. Finally, I noticed someone was using WireShark to see what .NET was doing. Why didn’t I think of that? (don’t answer)

It turns out WireShark was the key to solving this! When I looked at the traffic, I noticed that before giving me a 401 back, my server was giving me a 301. Wait, 301? A permanent redirect? All .NET was showing me was the 401! Yup, it’ll do that.

The url I was using was…
http://soggybyte.com/adir/afile.txt

The 301 Location response pointed me to…
http://www.soggybyte.com/adir/afile.txt

SON OF A… all this time, my problem has been the damn dub-dub-dub.

So, let that be a lesson to all of you. I’m not entirely sure what the lesson is, perhaps it’s “WOOO WIRESHARK,” but there we go. I learned something today.

30(+) Day Challenge

The idea of a blog is to write. I’ve had a site with some blog/CMS system (Wordpress, Drupal, etc) installed for about 4 years now and I think I’ve written a total of 6 posts. Most of them just got trashed when I moved from hosting the blog myself to letting tumblr handle the dirty work for me. So, in an attempt to get myself to f’n write on here I’m going to try something I’ve just read on a few people’s blogs.

The idea is that you’re given something different to write about each day for 30 (or more; I believe there are 60+ if I want to really try) days. I found that I was interested in what those people had to say about those topics. People are interesting, it’s an interesting world, so why not try to entertain someone else myself?

I’m really looking forward to this. I’ll see you guys tomorrow, Day #1.

Wife on Glenn Beck

I got home last night and my wife informed me that since I bitch so much about him, she decided to watch an episode of Glenn Beck’s show.

She thinks she may have made a mistake. Choice quotes:

What is this? He’s not making any sense, and where the fuck did that chalkboard come from?

Is he talking about Israel now? Why’s he talking about Israel? I thought we were just talking about who to listen to if your house was burning down! Pick a goddamned topic!

Ok this is too much. This guy’s a fucking whacko.

I love this woman!