Once the Microsoft Surface evolves into more real time applications, there may be so many occasions which demand an ASP.Net application to generate and distribute the Surface IdentityTags .For example when some one buys something related to surface in online the distributer can give him required surface tag through ASP.Net.
Let’s discuss how can we address that scenario.As discussed in one of my previous post there are 3 ways to generate or visualize Surface Identity tags.Among them 2 Methods are applicable here.One is using GenTag.exe utility and another is using the IdentityTagGenerator class.
Using GenTag.exe in ASP.Net
We can run this exe from our ASP.Net application.It will produce the tag image as a png file.Later we can send or distribute this image through our ASP.Net application.
Using IdentityTagGenerator class
I suggest this method which is based on the class IdentityTagGenerator.As you know, there are 2 methods for generating the tag.One is RenderTag and another is GenerateTag.We can use any of these methods in order to generate tags in ASP.Net
Basic idea of this is to have a page which accepts the series and value through it’s query string and generate the tag image according to that and returns the same though output stream.
This code is written in a file called IdentityTag.aspx and this file is referred in the other aspx files, which need to display the tag image.How to use IdentityTag.aspx is explained below.
The logic is same as GenerateTag.But here I used the render tag method
This is the file which generate the tag image and serve as jpg or png to the calling pages.This doesn’t have any aspx code in it.For more details how to write images directly into stream see my previous post.The whole IdentityTag.aspx.cs looks like below.
Using IdentityTag.aspx in default.aspx
This contains 2 textboxes to get values for series and value which are used to generate the IdentityTag.The button here sets the url of the image to IdentityTag.aspx with corresponding query string parameters.