Avoiding authentication during development

08 Dec 2009

When developing Silverlight applications that use authentication, it gets tiring to keep entering a password all the time. To avoid that, try this solution:

in App.xaml.cs, add: 

WebContext.Current.Authentication.Login("user", "pass");

in Web.config, add

<user name="user" password="<sha1-hashed pass>" />

Any place you try to modify the user needs to first check to see if any asynchronous operation is in progress:

if (!WebContext.Current.Authentication.IsBusy) {
	WebContext.Current.Authentication.LoadUser();
}

Now, you won’t see the login prompt again, but you’ll be logged in.

For generating the password, see this blog entry.