Perfil de PaulioIT BytesBlogListasScraps Ferramentas Ajuda

Blog


27 de fevereiro

Visual Studio freezing/crashing with Team System Foundation Server

Finally made the switch from Visual Source Safe to Team System Foundation Server today but as luck would have my machine didn't enjoy the experience. My colleagues machine was running fine, the speed difference in opening a solution or checking in/out was impressive. My machine would just sit there endlessly waiting for the check-in to work until finally I killed it off. It then occurred to me that I hadn't connected to the Foundation Server in my Team Explorer. Once connected everything seems to be running fine. So my tip is, ensure you've connected via Team Explorer before you attempt to use the Source Control.

24 de fevereiro

RIP IE6, goodbye old friend

To start off I'm not an IE6 hater. Much of what is written today vilifies IE6 but for me it's been a steady, if limited, platform. However, even I concede that it no longer fits the bill. I could second Calling time on IE6 reasons of it's limited CSS support or it's now poor JavaScript performance but the final straw for me is the lack of bug fixes. Sure Microsoft will fix the critical (aka security) issues but anything else it just isn't interested in. E.g. Want to use IIS compression and content-disposition? Yes please, but wait it doesn't reliably work in IE6 :( (Edit: note to Systems Admins, you should move away from IE6 too for the same reasons, the users should have the best experience including decent caching, compression, parsing, rendering and bug fixes - all things IE6 doesn't give you)

So I'm joining throngs of the ivory tower W3Cers and fed up web designers...



Although to balance out the post, Firefox, Safari and Opera can all be royal CSS pains in the....too!


Navigon TMC review

I "recently" purchased a dedicated Navigon SatNav (2100) with TMC as I thought my Pocket PC Navigon software was good if the TMC was a bit of a damp squid. Today I had to go on a fairly long trip around the south-east portion of the M25 and then up the M1 to Scunthorpe. The routing was, as usual, great but since I was the passenger I could keep a watch on the TMC signal. This isn't a very scientific experiment but these are my findings. 

First off the TMC signal was non-existent until we got past Rickmansworth, then we got a good 5 mins worth of signal. Lost it for the majority of the M25 until we got close to the M1. The M1 has a couple of longer signal windows, a couple towards Milton Keynes with the best around Derbyshire. A final little window near Scunthorpe itself. So although the coverage was sparse it was enough to give the unit time to download a reasonable amount of traffic information and it did report problems on the adjoining roads (fortunately nothing bad on the route itself).

So overall the TMC works but only in specific areas, if anyone reading this knows of these zones then please let me know, if you have anecdotal evidence of areas it works then please post a comment and perhaps we can compile a working map.

13 de fevereiro

UX catalogue

A bit of tenuous Silverlight post but hey it's running in Silverlight. A nice application showing a large number of user experience "patterns".
12 de fevereiro

Trouble selling Silverlight?

Just read an interesting blog about Evangelising Silverlight. I didn't realise it was realised in Windows Update, I'll have to check that out.
09 de fevereiro

Things to consider when developing with JavaScript

I admit that I'm used to using JavaScript to provide the odd bit of client functionality and to plug gaps with CSS. However, the more complicated script I write the more problems I find with it. So I found this slide show by John Resig to be very interesting (if you get the chance to attend a seminar by him then do so).

The DOM is a Mess @ Yahoo  
View more presentations from jeresig. (tags: dom javascript)

08 de fevereiro

Are you sure you want to create your own Custom membership provider?

As you may have read in my previous posts I've been investigating the use of the ASP.NET membership provider with Silverlight. The next stage was to write my own custom membership provider because I've a requirement to have a two part user name, much like Domain\User Name rather than just User Name. The web has a number of tutorials about rolling your own provider but for me this seemed like over-kill, I'm quite happy with the SQL Provider I just want to enforce a few extra rules, store a couple of other facts, audit specific changes, etc. Although I could use a regular expression to help me out it wouldn't fulfill all my requirements. So my solution is to just derive from the SQL Provider;
 

    public class MyOwnSqlProvider : SqlMembershipProvider          

    {

        public override bool ValidateUser(string username, string password)

        {

            System.Diagnostics.Debug.WriteLine(username + " - " + password);

            return base.ValidateUser(username, password);

        }

    }

 

There we have, I can intercept the calls, add my own rules, etc. The only other change is to the web config to tell the world about the new provider.

 

    <membership defaultProvider="MyAspNetSqlMembershipProvider">

      <providers>

        <add name="MyAspNetSqlMembershipProvider" type="MyMembershipDemo.Web.MyOwnSqlProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>

      </providers>

 

I'm not suggesting that this removes the need to write your own provider but if, like me, you only want to make a couple of subtle changes then this might save a lot of effort. BTW if you do want to delve deeper into writing your provider then you should take a look at Microsoft's Provider Toolkit

Silverlight cross-domain policy helper

One thing I didn't mention in my last Silverlight post was about how to create a cross domain policy file to allow Silverlight to use a web service. I found this xml snippet post to be very helpful.


More on Integrating Silverlight with ASP.NET membership authentication

Ok, so strictly this should be entitled Integrating Web Services and ASP.NET membership authentication but it's from a Silverlight client hence the title. So in my previous post I provided a link to a great article explaining how to get a Silverlight client to use ASP.NET membership features. The next step for me was how to a write a web service that will only allow calls from a Silverlight user who has signed in. Here is how I did it;

Assuming you have followed the previous post and now have a Silverlight client that can authenticate users via the membership providers then the next step is to write your web services.

1. Create Service
Although you can as a web service to the current ASP.NET site it's probably more likely that you'll want a separate web service project so Add->New Project->Web Service. If you're using the default templates then you should see a HelloWorld web method created for you.

        [WebMethod]

        public string HelloWorld()

        {

            return "Hello World";

        }


2. Connect the Service to the same Membership database
As I mentioned in my previous post, you're better off providing your own connection string for the membership store, so now you've created a new site you have to add the same connection string to the web service, something like;

  <connectionStrings>

    <remove name="LocalSqlServer"/>

    <add name="LocalSqlServer" connectionString="Data Source=.\MySQLServer;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>

  </connectionStrings>


3. Add a reference from your Silverlight client to the service
In the Silverlight project Add Service Reference and press discover. If your service doesn't show make sure you've built the project, VS sometimes won't spot the new project until it has been built.

4. Add the code to call your service
Nothing special here except you may want to catch exceptions because the user isn't authenticated (forgive the rubbish use of Execption here);

        private void TestService_Click(object sender, RoutedEventArgs e)

        {

            ServiceReference1.Service1SoapClient testService = new ApplicationServicesDemo.ServiceReference1.Service1SoapClient();

            testService.HelloWorldCompleted += new EventHandler<ApplicationServicesDemo.ServiceReference1.HelloWorldCompletedEventArgs>(testService_HelloWorldCompleted);

            testService.HelloWorldAsync();

        }

 

        void testService_HelloWorldCompleted(object sender, ApplicationServicesDemo.ServiceReference1.HelloWorldCompletedEventArgs e)

        {

            try

            {

                TestService.Content = "Test -" + e.Result;

            }

            catch (Exception)

            {

                TestService.Content = "Please sign in";

            }         

        }


To handle the exception correctly you need to delve into the inner exception but hopefully you get the idea.
5. Secure the web method
The easiest way to secure the method is to add a System.Security.Permissions attribute to the method;

        [WebMethod]

        [PrincipalPermission(SecurityAction.Demand, Authenticated = true)]

        public string HelloWorld()

        {

            return "Hello World";

        }

There you have it. One "secure" web service. If your user is authenticated via membership then they'll have access, if they don't then the service will tell a white lie and say the service doesn't exist.