Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

Host Windows Forms Controls in WPF – Keyvan Nayyeri

Process is simple.  First you need to add a HWND to your WPF applications in UI to host Windows Form controls there.  Actually you must derive a class from HwndHost base class to be able to do this but thankfully Microsoft has done the main job and has added a default implementation that is suitable for many common needs and it’s WindowsFormsHost.

 image

Via Host Windows Forms Controls in WPF – Keyvan Nayyeri

October 23, 2007 Posted by | WPF | 1 Comment

Secure Your ASP.NET Apps And WCF Services With Windows CardSpace — MSDN Magazine, April 2007

 

By Michèle Leroux Bustamante

Contents

Windows CardSpace and Information Cards
Personal Cards
Managed Cards
Browsers and Identity Selectors
Object and XHTML Parameters
Processing the Security Token
Associating Cards with an Account
Integrating Windows CardSpace with WCF
Conclusion

Via Identity: Secure Your ASP.NET Apps And WCF Services With Windows CardSpace — MSDN Magazine, April 2007

October 19, 2007 Posted by | CardSpace | Leave a Comment

Using CardSpace without using WCF or Browser

Getting CardSpace Tokens Programmatically

The wrapper allows you to  basically pass in the required details (issuer and target URI, the target identity as well as required/optional claims) and get back the encrypted XML token. 

This code snippet shows how to use the wrapper to get a token for a self issued card:

IdentitySelector selector = new IdentitySelector();

selector.IssuerUri = 
new Uri("http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self"); selector.TargetUri = new Uri("http://relyingParty"); selector.SetTargetCertificate("RelyingParty", X509FindType.FindBySubjectName, StoreLocation.CurrentUser, StoreName.AddressBook); selector.RequiredClaims.Add(ClaimTypes.GivenName); selector.RequiredClaims.Add(ClaimTypes.Surname); selector.RequiredClaims.Add(ClaimTypes.Email); string tokenString = selector.GetTokenString();

From this point on it is up to you to use this token in whatever way you want.

It is as easy a shipping a string to your relying party.

Download here

Via www.leastprivilege.com – Getting CardSpace Tokens Programmatically

October 18, 2007 Posted by | CardSpace | Leave a Comment

Using Windows CardSpace with WebService and Non-Browser Applications

 

Vibro.NET : Using Windows CardSpace for securing a WPF smartclient, in WCF & token caching sauce

Securing a Sidebar Gadget with Windows CardSpace and WCF

And his book:

Understanding Windows CardSpace: An Introduction to the Concepts and Challenges of Digital Identities

by Vittorio Bertocci; Garrett Serack; Caleb Baker

October 18, 2007 Posted by | CardSpace | Leave a Comment

Enterprise Application Architecture with LINQ to SQL – The Code Project – Design and Architecture

 

Contents

Via Enterprise Application Architecture with LINQ to SQL – The Code Project – Design and Architecture

October 17, 2007 Posted by | LINQ | 1 Comment

How to convert a street address to longitude and latitude (geocoding) via web services « Jim 2.0’s Blog

string geocoderUri = string.Format(
    “http://rpc.geocoder.us/service/rest?address={0},{1},{2}”,
    street, city, state);
XmlDocument geocoderXmlDoc = new XmlDocument();
geocoderXmlDoc.Load(geocoderUri);
XmlNamespaceManager nsMgr =
    new XmlNamespaceManager(geocoderXmlDoc.NameTable);
nsMgr.AddNamespace(“geo”,
    @”http://www.w3.org/2003/01/geo/wgs84_pos#”);

string sLong = geocoderXmlDoc.DocumentElement.SelectSingleNode(
        @”//geo:long”, nsMgr).InnerText;
string sLat = geocoderXmlDoc.DocumentElement.SelectSingleNode(
        @”//geo:lat”, nsMgr).InnerText;

double latitude = Double.Parse(sLat);
double longitude = Double.Parse(sLong);

Console.WriteLine(“Lat: “ + latitude + ” Lon: “ + longitude);

 

Result:

Lat: 41.947372 Lon: -87.655788

 

Once you have the coordinates, you can perform radius searching. Troy DeMonbreun provides an example of how to calculate the distance between two geographic coordinates using a SQL Server UDF (User Defined Function). The GeoCoder.us blog also discusses how to calculate distances using two geographic coordinates.

Via How to convert a street address to longitude and latitude (geocoding) via web services « Jim 2.0’s Blog

October 17, 2007 Posted by | Tools | 2 Comments

Using WiX to create installer packages on HealthVault Connection Center

 

  1. Building Connection Center add-ins using WiX – part 1
  2. Building Connection Center add-ins using WiX – part 2
  3. Building Connection Center add-ins using WiX – part 3
  4. Building Connection Center add-ins using WiX – part 4

October 16, 2007 Posted by | Tools | Leave a Comment

Writing custom LINQ provider

 

In this post, I will show  how to create a sample LINQ provider.Creating LINQ provider can be far more complex, but here I will demonstrate the very basic one to start.

This sample is done by using VS2008 Beta 2. I finished of this is post by creating a fictious Person query provider that in turn the gives a glimpse of creating custom LINQ provider for pulling data from source, in a more descriptive and convenient way, rather calling out boring GetBy methods.

Via Writing custom LINQ provider – Mehfuz’s WebLog

October 15, 2007 Posted by | LINQ | Leave a Comment

Windows Home Server Add-ins | We Got Served

 

This site has some of the newest and handiest Windows Home Server Add-ins available. One I particularly like is the Program Launcher add-in. Great for getting into Regedit, Command Prompt or just about any other program you need to run from the WHS console. http://www.wegotserved.co.uk/windows-home-server-add-ins/ Share this post…(read more)

October 15, 2007 Posted by | Tools | 2 Comments

Windows Home Server Toolkit v1 – The Nuts and Bolts

 

As you’ve probably seen from Robert McLaws’ blog post, there’s a new Toolkit for Windows Home Server.  There are several components to this. Some run in the WHS Console as an Add-in, and others can be run locally on the client, or the server. 

The Console Add-in gives you a new item under Settings, labeled Toolkit.  From there you have 4 available tabs. Remote, Storage, Backup and Support. 

On the Server side of things………….

The Remote tab gives you access to tools to help with troubleshooting and configuration of the Remote Access web site.

whstoolkit_rmt

And more screenshots via Windows Home Server Toolkit v1 – The Nuts and Bolts

October 15, 2007 Posted by | Tools | Leave a Comment

Follow

Get every new post delivered to your Inbox.