ASP.NET Authentication using WCF Authentication Service returns “AuthenticationService is Disabled”
Posted On Thursday, September 16, 2010 at at Thursday, September 16, 2010 by Ben HI recently deployed a solution I was working on that used ASP.NET Authentication via the WCF Authentication Service. When I called the service it returned a fault exception that read:
AuthenticationService is Disabled
I could not figure out why. What happened was my web.config on the server was lacking the following entry to enable the service:
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true"/>
</webServices>
</scripting>
</system.web.extensions>
I hope this helps solve your problem.
ASP.NET Authentication using the WCF Authentication Service is Not Working
Posted On at at Thursday, September 16, 2010 by Ben HI’ve used ASP.NET Authentication on a handful of projects. I am using it now as well and I ran into some strange issues that I wanted to pass along. First of all this is one of the most useful post I found on using the WCF Authentication Service. Read that post for a good step by step guide.
I had everything setup and it appeared to be working. When I would call the Login method on the service I got back true telling me everything was working. However, the very next line I would try to call a method on my custom service that resided on that site and I would get an unauthorized request. I pulled my hair out on this for a long time until I found this new .NET Framework 4.0 entry in the web.config.
<machineKey validationKey="Your Key" decryptionKey="Your Decrypt Key" validation="SHA1"/>
This new entry is needed for applications that run on separate servers to talk the same language when doing authentication. Obviously you will need generate your own keys for your sites but this fixed it for me. This entry is needed on both the server calling the Authentication Service as well as the server hosting the service.
There could be multiple reasons authentication fails, but this is the one that bit me and took a long time to figure out. Hopefully this will save you the trouble I had to go through to get this fixed.
Server Side and Client Side Caching with .NET and the Microsoft Sync Framework
Posted On Wednesday, June 30, 2010 at at Wednesday, June 30, 2010 by Ben HI recently presented at the Denver Visual Studio User Group on this topic. The approach I took was to start with an out of the box working Silverlight application and then tweak to using caching for performance reasons. The next step is to persist that cache on the client side to make it even faster and not even require a round trip to the server. After that I took it even further by saving the entire data structure to isolated storage to allow offline use of the application using the out of browser option of Silverlight. Finally I expanded it even further by turning it into a WPF application that stored the data in a local SQL Server data base that was synced back to the server using the Microsoft Sync Framework. To me this is a pretty natural progression of an application. Build the prototype and then tweak it through different phases to expand it’s capability.
While building these demos I had to refactor a bunch of things through the progression of the changes. This again to me is very natural. I find that if I start by simply solving the problem the pieces of the system that need to be refactored and extend become crystal clear in the end. Where as if I try to architect the application for every possible future change I tend to end up with an over architected system. Again keep it simple and refactor later.
I think we all know caching is an essential part of almost every web based application. That was the gist of the first part of the presentation. The last part showed some of the pros and cons of the Microsoft Sync Framework. There is some great documentation around this framework here. If you are new to the sync framework I suggest taking the time to read through a couple of these docs to understand how it works. My slides also contain some of information regarding the sync framework. My personal take on it is it is pretty easy to get started with. The issue I have is what happens when you get errors. Synchronizing two data sources is by nature a difficult process and errors will occur. Using this framework is kind of like using a black box. You sometimes want more control than you are going to get. Bottom line if I was looking to sync multiple data sources I would start with this framework. It is a no brainer to get started with and provides a ton a cool functionality. However, if I started having issues I might revert back to my old ways of just building a sync tool for my own need.
I had a great time presenting and putting together this talk. Below is a link to the slides and the completed solution if you are interested.
SQL Server, SharePoint and .NET Virtual Conference – VIP Code
Posted On Saturday, March 20, 2010 at at Saturday, March 20, 2010 by Ben HI’m happy to say that I am presenting for the SSWUG.ORG Spring '10 Ultimate Virtual Conference. This is a three day conference full of great information related to the Microsoft stack. Most presenters are MVPs but all are industry leaders who share their real world experience during their fifty minute sessions. The cost of the conference is $190 for early birds. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
Design Patterns and Best Practices Using the ADO.NET Entity Framework
Posted On at at Saturday, March 20, 2010 by Ben HThe last session I taped was a demo filled session on how to create a robust multi-layer application using the ADO.NET Entity Framework as the data access layer strategy. Entity Framework is not perfect. However, it is a great starting part that allows for extensibility that makes is a nice part of an application’s architecture. EF 4.0 has taken great strides and gives the developer total control of the generated code via T4 templates. This session contain less than 10 slides and pretty much 40 minutes of demos. If you are interested in watching this session please sign up to attend the virtual conference. The cost is minimal ($190) and the ROI will be huge. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
Building a Multi-Page Silverlight Application
Posted On at at Saturday, March 20, 2010 by Ben HI also finished taping my Silverlight session. In this session we start from scratch with building a Silverlight navigation application. We walk through setting up the URI mapping to provide deep linking. We also wire up some data that the deep linking will use to look up data based on the link. This is a great session for anyone thinking about using Silverlight to build a multiple page applications. If you are interested in watching this session please sign up to attend the virtual conference. The cost is minimal ($190) and the ROI will be huge. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
Beginning C# and Object Oriented Programming
Posted On at at Saturday, March 20, 2010 by Ben HI just finished up taping of two sessions for the SSWUG virtual conference. The sessions were Beginning OOP with C# part I and II. I think the sessions went well. The sessions walk through the basic concepts of creating and using objects. They start simple and expand to refactor the solution as the business requirements change. If you are new to C# and trying to make sense of it all these are the sessions for you. If you already understand the basic concepts of OOP, in part II we dig into some more advanced topics related to interacting with database and saving, updating and deleting the data in your objects. I think there is something for everyone in this two part series. If you are interested in watching these sessions please sign up to attend the virtual conference. The cost is minimal ($190) and the ROI will be huge. Check out a list of all the great sessions and register at www.vconferenceonline.com. You can get a $30 discount if you use my VIP code of BHOELTINGSPVC10. Enjoy!
Rocky Mountain Tech Trifecta - .NET Beginner’s Track
Posted On Monday, March 01, 2010 at at Monday, March 01, 2010 by Ben HLast Saturday was the 2nd annual Rocky Mountain Tech Trifecta. Just like last year it was a great event. For a list of the speakers and topics go to the site for the event here. Julie Yack organized the event this year and it was awesome once again. Kathleen Dollard put together a beginners track and Jeff Certain, Drew Devault and myself where lucky enough to do the presentations. Jeff did a great job going over the best practices related to architecting an application. His main point was that coding furiously with no design in a bad idea. Instead use UML and other technologies to design the architecture first. It might take a bit longer at the start, but it will save time in refactoring and backtracking later.
The topic of my talk was beginning ASP.NET. It is almost impossible to decide on how to talk about ASP.NET in a 75 minute session. Most of the audience was familiar with HTML and JavaScript concepts. So, I decided to focus on how to utilize ASP.NET to help extend the concepts and languages you already know. I talked about code behind and how it automatically wired up events and some state management. We also talked a bit about master pages and themes. At the end I showed a bit more advanced stuff like AJAX and the AJAX Control Toolkit to display some of the power of ASP.NET. After my session I created a basic media player to fit in the application using Silverlight. Drew also created a media player that worked outside the browser and was not integrated into ASP.NET.
In the end I think it was a great day. Below are the slides and demos from my session. The demos do not include the final version of Jeff’s code or Drew’s Media player. They are my web application and the architecture as it was when I started. Thanks to those that attended and let me know if you have any questions.
Free .NET Events in Colorado
Posted On Friday, February 05, 2010 at at Friday, February 05, 2010 by Ben HI just wanted to let everyone know about some upcoming events in the Colorado Area.
Rocky Mountain Tech Trifecta is coming on Feb 27th in Denver. This is a free event that is comprised of sessions on almost any of the Microsoft product lines. I will be presenting in the beginners track on building a front end using ASP.NET. For more information and to register visit the link below.
MSDN Events Presents: Cloud Computing and Azure on Mar 9th. This is a free event also in the Denver. Again for more information use the link below.
I also wanted to let everyone know about the South Colorado .NET User Group. We meet on the first Tuesday of the month. This last Tuesday we had a great presentation from Joe Wilson on ASP.NET MVC. If you are not a member of out group you should be. Below is a link to our site.
Birds of a Feather (BOF) at PDC 2009
Posted On Tuesday, October 06, 2009 at at Tuesday, October 06, 2009 by Ben HI’m excited to announce that I will be leading a BOF session at PDC 2009! The topic is related to something we discussed at the Denver Visual Studio User Group a couple months ago. At that meeting we talked about the issue of deciding on a front end technology for web applications. There are a bunch of technologies out there and deciding on the right one can be overwhelming. The nice thing about this topic is there really is not a right or wrong answer, which makes it perfect for a BOF session. If you are going to PDC be sure to attend this session so we can discuss the topic as a community. Here is a link to the details:
http://www.pdcbof.com/post/203606737/bof-session-should-i-use-silverlight-mvc-or-web
See you there!
.NET Rx Framework – A New Way To Handle Asynchronous Programming
Posted On Thursday, October 01, 2009 at at Thursday, October 01, 2009 by Ben HI literally just read this article and wanted to get it out here for people to read. This article outlines some of the comments made by some of the people behind the technology. Give it a quick read and go do some more research. Here is a Bing search I did and there is a bunch of good info on it. I don’t think it is ready for production currently. However, I believe this is going to be a big part of VS 2010 and how we deal with the asynchronous nature of programming to services over a network.
Microsoft AJAX CDN (Plus jQuery)
Posted On Thursday, September 17, 2009 at at Thursday, September 17, 2009 by Ben HI just saw this today and it looks cool. Let me give you the high level overview and then you can go to Scott Guthrie’s detailed post. A while back I started to use jQuery to help with all my JavaScript coding. I really like it. Even if you don’t use the really advanced features it is a huge help just selecting and operating on elements client side. If you want some more info on jQuery just search the web and you will find tons of good documentation out there on the blogosphere.
So, one of the hassles with jQuery is that you have to include the libraries in script tags on your page in order to use them. This is not a huge deal, but it can be a pain if you want to use the libraries in multiple projects and maintain one central version of the jQuery libraries. That is were the Microsoft AJAX CDN comes into play. It is a Microsoft hosted version of both the AJAX libraries and the jQuery libraries. So, you can point to a Microsoft URL and bring in these libraries. This will find the location that is closest to your user and bring down the libraries from the cache on that server. Should be a much faster solution for everyone. Check out the details on Scott Guthrie’s blog here.
More on C# Dynamic Programming
Posted On Tuesday, July 14, 2009 at at Tuesday, July 14, 2009 by Ben HJust wanted to share this article on C# dynamic programming from DevFusion. It explains the difference between anonymous types and dynamic programming. Don’t get too caught up on the opinions of the author Mike Jones. Whether you agree with him or not this is a great explanation of using the dynamic keyword in C#.
Enjoy!
Silverlight 3 Jumpstart Book
Posted On Monday, July 13, 2009 at at Monday, July 13, 2009 by Ben HJust wanted to let everyone know that my employers and friends Dave and Julie Yack have done it again. They have published another book. This one is a 200 page jumpstart to the recently released Silverlight 3. I helped do some tech editing of the book the last couple weeks and I can say it is really good for getting started with Silverlight. Read more about the release on Julie’s blog here. You can also get some more details about the book at the books website http://silverlightjumpstart.com/Default.aspx or on Amazon.
Happy reading….
Dynamic Programming with C# 4.0
Posted On Friday, July 10, 2009 at at Friday, July 10, 2009 by Ben HYesterday Joe Mayo talked to the South Colorado .NET User Group about the new features of C# 4.0. The most interesting change is the addition of the “dynamic” datatype. This datatype allows developers to declare a variable that is not actually typed until runtime. This is different than the “var” keyword which actually types the variable using the return value from the right side of the equals sign. Let’s take a look at a quick example:
1: private void Main()
2: {
3: Dog thisDog = new Dog();
4: AnimalSpeak(thisDog);
5:
6: Cat thisCat = new Cat();
7: AnimalSpeak(thisCat);
8:
9: Frog thisFrog = new Frog();
10: AnimalSpeak(thisFrog);
11:
12: Bird thisBird = new Bird();
13: AnimalSpeak(thisBird);
14: }
15:
16: private void AnimalSpeak(dynamic Animal)
17: {
18: Animal.Speak();
19: }
The dynamic datatype is very powerful, especially when it comes to dealing with COM interop. It also will aid test driven development (TDD) by allowing developers to write unit tests without worrying about the actual implementation of the objects they are testing until after the tests are written. Again very powerful.
However, with great power comes great responsibility.
I feel that there are a couple issues with dynamic programming. It seams we have come full circle with .NET. I remember when .NET first came out and everyone was promoting type safety as a huge benefit. Now with dynamic programming we can bypass type safety and just wing it. One problem I have with this is that the errors are runtime errors. So, for example lets say we are accessing a COM object dynamically. In our dev environment we have a the new version of the COM object that supports some new functionality we are using. If we move the application to test or prod and forget to upgrade the COM object, the application may start and run without a problem but will bomb at runtime whenever a user tries to access that one section of our app that is using the new functionality. To me this puts too much emphasis on QA testing when the application still compiles but may bomb at runtime.
Another disadvantage of dynamic programming is the lack of intellisense. If you declare the variable as dynamic then intellisense will not work. Again, this opens up the issue of misspelling some of the properties or methods that will not get caught until runtime. I really like intellisense so I will not use dynamic unless it is the last option.
My fear is that many developers will get lazy with dynamic programming and use it in the wrong situations. Using it as a replacement for using interfaces or good old fashion reflection may cause more runtime issues that slip past testing and hit production users. Some developers may see that as job security. I see it as a sure fire way to lose customers.
Silverlight 3 and IE 8 Compatibility – Silverlight Control Not Sizing
Posted On Friday, June 12, 2009 at at Friday, June 12, 2009 by Ben HI ran into an interesting issue with IE 8 and Silverlight 3 today. We recently switched over to Silverlight 3 to start testing for the upcoming upgrade. The Silverlight 3 conversion went pretty smooth and it all worked in the test website we are using in the Silverlight solution. However, once we moved it to QA the sizing of the ASP.NET Silverlight control was not correct. It kept cutting the Silverlight stuff short. Not sure what the deal was, but I was able to fix it by wrapping the ASP.NET Silverlight Control in a div tag. Wraping the control with this div will get it working but I’m not sure if it is a long term fix.
<div style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
</div>
SQL Server and .NET Virtual Conferences
Posted On Friday, April 10, 2009 at at Friday, April 10, 2009 by Ben HI am happy to say I am presenting at the Spring ‘09 SSWUG.ORG .NET vConference on April 22, 23, 24. I recorded my sessions earlier and I’m please with the results. If you are not familiar with the vConference format you can get a 10 minute sample of one of my presentations here. The cost of the conference is only $125 and since it is a virtual conference there are no additional expenses. There really is some great content presented by outstanding presenters. Here is the link to check out all the SSWUG vConferences going on:
https://www.vconferenceonline.com/upcoming.asp
I also wanted to point out a free event that is going on Friday, April 17th. Here is the link to the free event:
https://www.vconferenceonline.com/shows/spring09/sql/s09event.asp
I will keep this blog updated with my content and slides once the conference begins.
Extending the ADO.NET Entity Framework
Posted On Tuesday, March 24, 2009 at at Tuesday, March 24, 2009 by Ben HLast night I gave a presentation on the ADO.NET Entity Framework at the Denver Visual Studio User Group. It was a great discussion and the questions from the audience helped me tell the story I was trying to tell. That story is that the Entity Framework is a great data access tool. It’s extendable and in turn flexible enough to meet the needs of the small point solutions to the enterprise caliber solutions. What I really like about it is the ability to start simple. Let’s get a solution up and running and then go back and extend\refactor certain areas to improve the architecture and\or performance. That’s not saying we shouldn’t do some design work up front, but let’s start by getting a solid solution built and then add on features and improvements in the future.
Sometimes I think architects focus too much on creating the perfect architecture instead of creating a flexible one. The solution just needs to work given the current requirements. Beyond that, it also needs to be flexible so it can change when new requirements and features get defined. EF lends itself very well to flexibility and extensibility.
The zip file below contains the final solution. That solution has all the extensions we did to the context as well as the entities in the context. It also includes a basis for a validation framework. The validation framework could use some tweeks to make it better. I leave that to you and your creative minds.
The zip file also contains a SQL script that will quickly and easily create the sample DB for you. Both the schema and the data. All you need to do is change the location of the DB file (.mdf) and the log file (.ldf) in order to run the script. Once you get the DB created you will have to change the server name in the connection string located in the web.config. After that everything should run great. Here is the zip:
I hope that you enjoyed the talk. If you would like the step by step guide to creating the initial model and setting up the inheritance please visit Rob Bagby’s blog of EF.
XRM Taking Off
Posted On Wednesday, March 18, 2009 at at Wednesday, March 18, 2009 by Ben HAt Colorado Technology Consultants (CTC) we do quite a bit of work with MS Dynamics CRM. One of things Julie and David Yack are big on is the concept of XRM. If you are not familiar with it, it extends the Customer Relationship Management side of MS CRM to any kind of Line of Business application. MS CRM is a very customizable product and can be extended to be used for many non CRM type applications.
That being said CTC is kind of the XRM gurus right now. Dave’s book on the subject is actually being used on MSDN in some places as reference material. You can purchase the entire book, including a usable .NET framework that comes ready to use with the book, here. Julie is starting up an XRM Virtual User Group that will consist of monthly Live Meetings related to the XRM space. The user group site is actually built on top of MS CRM Live and hosted on Azure in the cloud. Please visit the site to check out an impressive display of XRM and to register with the group.
XRM is becoming one of the hot Dynamic products. So, you next step is to attend the XRM Virtual User Group meetings and learn how to use XRM to solve your software needs.
Iterating Through a Collection Using Reflection
Posted On Tuesday, March 10, 2009 at at Tuesday, March 10, 2009 by Ben HI ran into an issue today using reflection. I was getting properties on a object using the following code:
1: Type argsType = args.GetType();
2: PropertyInfo piResults = argsType.GetProperty("Result");
3: object result = piResults.GetValue(args, null);
This works great if the object you are trying to retrieve is just a simple object. However, what if the object in question is a collection of some sort? This does not work because the results of type object are useless. The key to solving this issue is to use the IEnumerable interface. Here is the code to solve my issue:
1: Type argsType = args.GetType();
2: PropertyInfo piMessageList = argsType.GetProperty("Result");
3:
4: IEnumerable Messages = (IEnumerable)piMessageList.GetValue(args, null);
5:
6: Type objType;
7: PropertyInfo objResults;
8: foreach (object thisMsg in Messages)
9: {
10: objType = thisMsg.GetType();
11: objResults = objType.GetProperty("Message");
12: Processmessage(objResults.GetValue(thisMsg, null).ToString());
13: }