Search This Blog

Wednesday, June 25, 2008

Speaking at Cleveland C#/VB.NET User Group

I am just recovering from giving a talk at the Cleveland C#/VB.NET User Group in Cleveland, OH yesterday. My talk was about LINQ and it's various flavors including LINQ to Objects, LINQ to SQL, LINQ to XML, and LINQ to Entities. However, my talk was specifically about the first two. To be honest, each of the different subsets could take a whole presentation on own because there just so much to cover in a relatively short amount of time. Overall, I would say that the majority of the people that came out really enjoyed the presentation and could take something away from in the end.

For all of you who subscribe to my blog, the links to the sample code and slide decks are listed below.

Click to get access to my sample code and slide decks.

Sunday, June 22, 2008

Lansing Day of .NET

After attending the first annual Lansing Day of .NET in Lansing, Michigan, I was impressed with the sessions and the content. There were several sessions consisting of the ASP.NET MVC Framework, LINQ to SQL, Test-driven development, Agile Project Management, Structuring your solutions in Visual Studio, Introduction to WPF, Getting Started with WCF and many more. I think the conference was a big success in terms of turn out and by the content that was presented.

Tuesday, June 3, 2008

How to Disable the Back button...

In my queries against the Internet in hopes of finding a clean way of keeping users from using the back button in my application I have found a simple way to go about this. Let me first start off with the problem at hand. Many of us writing code for the web experience this all the time with users using the backward and forward buttons of their browsers when testing and working with our applications. So, say for example we have some pages that we don't want the user to be able to hit the back button and go to because if they do our code will possibly break, blow up, or insert another record. All of these and many others are not good.

So lets look at some of the obvious examples to fix this problem. One possibility is to close the current window and open another window that does not have the toolbar enabled. That may work for some, but is not the best approach. Another approach out there is to clear the browser's cache and force the client to request the web page again. This works just fine but you will also need to make use of session variables to keep track of whether or not the user has already visited this page in the current session. Another method that I find pretty easy and straight-forward to use is with some simple javascript. Here is an example: (Blogger doesn't like html or body tags in their posts, so be creative.)

"body onload="history.go(1)

From this example any web page that you include this javascript in will not allow the browser to ever return to the previous page. Basically, what is happening is that the javascript is telling the browser when the page loads to go forward 1 page in the history collection. Pretty neat, huh? This works well for scenarios where you want the user to navigate around your site using links and navigation elements. This method is actually better in some cases in that it will use the cached page instead of going back to the server. One thing to note is that there is no real way of disabling the browser's buttons. If anyone has any other cool ways of doing this please respond to this post.