Posts
1145
Comments
890
Trackbacks
1
June 2013 Blog Posts
ASP.NET MVC Forms Authentication Reminder

When implementing Forms Authentication, even when you do all that stuff to create an authentication ticket, you also have to remember to add to the root level web.config the configuration data needed to make sure Request.IsAuthenticated actually comes back true, along the lines of:

<authentication mode="Forms">       <forms loginUrl="~/Account/LogOn" timeout="2880" />     </authentication>

Inside of the

  <system.web>

tag.

posted @ Wednesday, June 26, 2013 9:16 PM | Feedback (0)
Resolved: Unable to start debugging on the web server

In a previous post, I mentioned how, for some reason, I could not get VS 2012 to debug an ASP.NET MVC 4.5 Razor web app (or whatever you should call them).

It turned out to have nothing to do with the MVC version (which I sort of suspected from the start).

I was having difficulties getting some CSS changes to apply to the site using IIS.  I love/hate CSS in general, but definitely when it comes to the development process.  Usually, when using VS 2012, you can make a change, rebuild the site, and the change immediately updates on the site.  Every once in a while, it caches the old CSS file mysteriously, so you quit and give up trying to figure out why your CSS isn’t showing, then come back two hours later, and lo and behold, now you can see them.  I love that.

Anyhoo, I was working on some CSS items, and they just were not showing up in Firebug, so I decided to change the site to debug using IIS Express, just to see if that would show the changes.  So, I make the change and then I….wait a minute.  What the hell.  Oh.

The long and the short of it….this web app is an admin type site, which means it requires running under https (which I set on the controllers using an RequireHttps attribute) for everything but the login page, and so if you try to go to the home page, it will see you haven’t authenticated, and redirect you to the login page.  The Project Url and the Start URL within the site properties pointed to the home page (which is a dashboard type thingy), which requires running under https, but the url entered started with “http”, not “https”, so changing that fixed the problem.

I have no idea why VS 2012 gives the obscure error that it does.  But problem resolved.

Well, almost.  My CSS changes still aren’t appearing, but that’s probably just because I suck at CSS.

posted @ Tuesday, June 25, 2013 7:42 PM | Feedback (0)
Porcupine Tree – Anesthetize (Live)

It appears, for reasons that I understand but mourn, that Porcupine Tree may never play again.  Steven Wilson’s latest solo band offers him a range of musical expression that Porcupine Tree does not satisfy

This saddens me, being a band that, in some ways, brought me back to life.  I won’t detail that.

Having said that, I am glad that at least a version of their (arguably) greatest work is now available on YouTube.  Since it is not officially released through the band, that’s always subject to change.

Gavin thrashes (as good a drummer as exists in the world), John and Steven play their hearts out, Richard lays out a space for the song, Colin grooves it out….musical tastes are inherently personal.  You like things or you don’t.  But this is Porcupine Tree doing what they do.

Water so warm that day (water so warm that day)
I counted out the waves (I counted out the waves)
As they broke into shore
I smiled into the sun
The water so warm that day
I was counting out the waves
And I followed their short life
As they broke on the shoreline
I could see you
But I couldn't hear you
You were holding your hat in the breeze
Turning away from me in this moment
You were stolen as black across the sun

Enjoy.

posted @ Sunday, June 23, 2013 9:54 PM | Feedback (0)
Asp.Net MVC Razor 4.5: Unable to start debugging on the web server

Update: check here for the resolution, the problem has to do with http vs. https, not with the razor version.

I’m putting this in as a placeholder in case I can figure out what the solution is.

I have two razor web sites, one is MVC 3, the other MVC 4.5 as sub-applications under a common route.  Normally, when you get this error, it is because of the virtual directory isn’t created properly, or there’s something funky with the application settings, or the app pool….something along those lines.

However, while the MVC3 site can be debugged just fine, the MVC 4.5 one can’t, failing from Visual Studio 2012 with this error.  The site itself actually works, and I can debug from IIS Express.

Normally, my Google-Fu can solve this sort of thing.  I’m hoping the act of posting helps trigger whatever triggers my troubleshooting superpowers to resolve it.

posted @ Saturday, June 22, 2013 6:44 PM | Feedback (0)
xkcd: The pace of modern life

From xkcd:

posted @ Saturday, June 22, 2013 4:24 PM | Feedback (0)
Hibernating Rhinos’ Entity Framework Profiler Mini Review

This doesn’t really constitute a review, just a couple of comments, but whatever.

In some previous posts, I had talked about my experience with Hibernating Rhinos’ Linq to Sql profiler.  Basically, it failed for me, didn’t even function properly, and Ayende was unable to help.

Anyway, I’m working on something that uses Entity Framework, so I figured, what the hell, I’ve give it one more shot, I’ll just get the EF Profiler, and not the entire suite, and see how it works.  I can expense it.

So, the first thing I did, obviously, was hook it up and see if it, well, you know, actually functioned.

That all went fine, which is obviously a good thing.  I profiled the web application for a little bit.  No red alerts, good.  I sort of expected at least one or two, since I suck as a developer, so was glad to get some warm fuzzies.  There were some of those annoying grey ‘unbounded result set’ alerts, but you can ignore them, turn them off, etc.

But, like most sucky developers, I put it away and figured I’d profile everything at the end.

And then, while I was working on something, I realized that the SQL my Entity Framework code was producing was wrong, as there was a serious bug in how some functionality was working.

Now, any decent SQL person will recognize the following as fairly typical when trying to figure out annoying SQL issues:  fire up SQL Profiler, create a trace, work through the UI to reproduce the bug, save off the trace to a table, do some querying to find out what SQL is being generated, and then figure out what’s up.  This isn’t difficult, by any stretch of the imagination, but it does take some work.

I figured, what the hell, if EF Profiler is any good, it should really help in a situation like this, without me needing to do much.

So, I fired it up, and worked through the UI to reproduce the bug. 

Well now.  There’s the details of the query.  And the stack trace.  And you can jump to the code.  Well, sometimes.  Other times, it just says it can’t find the source file.  I only just noticed this now, it worked before.

But, from the query details, I can see that Johnny Dumbass Developer forgot to manage null properly.  Bad Johnny Dumbass.  30 seconds later, work through the UI, bug gone.

Not bad.  I’m not sure why the source file can’t be found.  I still hate that the damn thing tries to auto-update even though I don’t want it to.  There’s still a little too much friction from the get go with it.

But, it probably saved me quite some time here, so I definitely don’t feel terrible about it like I used to.

posted @ Tuesday, June 18, 2013 8:04 PM | Feedback (0)
Steven Wilson – The Raven That Refused to Sing (Live)

My favorite song from one of my favorite musical releases in years.

Please, come to me.
Please, stay with me.

Please
Please
Sing
Stay

Sing to me, raven
I miss her so much.

Enjoy.

posted @ Saturday, June 15, 2013 2:57 PM | Feedback (0)
A few tips for the weekend golfer

Hey there.  If you like to play the occasional round of golf on the weekend, here are a couple of pointers.

You aren’t that good, so you really don’t need GPS to tell you that the distance to the pin is 137 yards vs. 138 yards.  It doesn’t make that much of a difference.

You don’t need to make 10 practice swings.  Your real swing looks almost nothing like your practice swing anyway.

You don’t need to line up the putt, and then back off and examine the green for another 30 seconds.  You can’t really read them that well, and even when you do, your putting stroke isn’t that reliable.

Really, it will make everything go a lot more smoothly if you try to remember these things.

Thanks.

posted @ Sunday, June 09, 2013 7:04 PM | Feedback (0)