SterlingPorter.net

December 30, 2006

USBtoEverything.com – High school students try affiliate marketing

Filed under: Uncategorized — sterling @ 2:30 am

A few months ago, I bought the domain name usbtoeverything.com with the intent to try my hand at affiliate marketing.  However, with my full-time job at Sewell Direct and my side work with Sno Shack, I just haven’t had to time to tackle that project, mainly because of all the time it would require to write copy for all the products and keep tabs on the traffic.

Then, I found out my little brother’s Montessori school in Rexburg, Idaho, was looking for ways to raise money for their annual educational field trips.  I thought USBtoEverything.com might be a good way for them to practice some technical writing skills and learn about affiliate marketing along the way.  So I set up a Word Press blog for them to use to post products to the site. 

Their first step was to sign up with affiliate programs like LinkShare that would give them an easy way to generate product links to sites like TigerDirect.com.  Next, they started adding products.  It’s been a little slow-going so far because the kids have had to get their bearings on what in world things like a USB to IDE adapters are.  But they’re making progess.  Hopefully in a few months they’ll start seeing a little income. 

Just as a side-note, my similar site videoipodaccessories.com has brought in a whopping $5.27 since February 2006.  Let me be clear that all I did on that site was write a little ASP.NET control that pulls down basic product information and pricing from Amazon’s associate API.   I’m doing zero marketing.  Anyway, I just wanted to highlight the differences between usbtoeverything.com and videoipodaccessories.com.  First, the Montessori kids are writing their own copy, so instead of just copying TigerDirect’s product descriptions, they are rewriting it in their own words.  This should help their SEO.  Furthermore, as they add more products, they will be writing comparison pages that will show a list of something like USB to Serial adapters from different vendors.  The list will include pricing and other info like shipping rates/times, etc.  This should provide value to visitors to their site.  Conversely, on videoipodaccessories.com, I am providing no real value above what Amazon already provides because I am only using the data retrieved from Amazon’s API.  Hopefully, these “better” features of USBtoEverything.com will help them make more than $5 over the next year. 

Of course, we might need to look into using Google Adwords to directly market the “long tail” products, but that is a can of worms that isn’t very tempting to open right now.

December 22, 2006

.NET Remoting connection issues over VPN

Filed under: .NET — sterling @ 5:38 am

Lately I’ve been working on a “smart client” application that connects to a company application server. The app server acts as a write-through cache on the way to the back-end database. Multiple smart clients can interface with the app server as well as a few web sites. All communication between the app server and its clients is done using .NET remoting. One of the advantages of the smart client and how is uses .NET remoting is that I can enforce role-based security using the WindowsPrincipal.IsInRole function. I can prevent anyone who is not a member of a designated security group from even running the smart client. Cool, eh?

Unfortunately, a problem arose when users tried to run the smart client to connect to the app server over a VPN. In this situation, the call to IsInRole() failed every time, even though the user had provided his domain credentials when logging into the VPN. I assumed that Windows would simply be able to check a given group (e.g. DOMAIN\Security Group) against all the known identities, i.e. local account and the domain account authenticated when the VPN connection was made. However, this is not the case. Apparently, there is no way to use the credentials that are used to authenticate on the VPN. Simply put, if you call IsInRole() on the client machine, it will use the local account, and unless the local machine is a member of the domain in which exists the said group (or if the domain is trusted by the first domain), then IsInRole() will fail.

Of course, the point here is to provide single-sign-on authentication. In other words, only make the user provide credentials once–when connecting the VPN. After a lot of reading and a support incident with Microsoft, I arrived at a solution.

My first mistake was to try to implement role-based security in the smart client. For many reasons, including security risks, role-based security should be done on the server in a client/server architecture, NOT in the client. Secondly, the domain credentials used to authenticate over the VPN are only used for data going OUT over the VPN. In other words, local applications (including the smart client) are run under the local account, but remoting calls headed to the app server arrive in the context of the authenticated domain account. So, with some proper configuration, the app server can perform role-based security checks on this account context.

The key is how you instantiate the TcpServerChannel object when setting up your .NET remoting calls on the client and server. The following code is an example of how to do it on the SERVER:

// Setup the configuration parameters through a dictionary
IDictionary properties = new Hashtable();
properties.Add(”port”, channelPort); // e.g. 8080
properties.Add(”secure”, true);
properties.Add(”impersonate”, true); // allows us to do role-based security on the server

// Create an instance of a channel
TcpServerChannel serverChannel = new TcpServerChannel(properties, null);
ChannelServices.RegisterChannel(serverChannel, true);

Here is how you do it on the CLIENT:

// Setup the configuration parameters through a dictionary
IDictionary properties = new Hashtable();
properties.Add(”secure”, true);
properties.Add(”connectionTimeout”, 5000);
properties.Add(”tokenImpersonationLevel”, “Impersonation”);

TcpClientChannel clientChannel = new TcpClientChannel(properties, null);
ChannelServices.RegisterChannel(clientChannel, true);

The “impersonation” properties on both the client and the server make it so when a remoting call occurs, the app server executing the method will assume the identity context of the caller (e.g., the domain account being used over the VPN). With this great feature, you can call IsInRole() and perform your role-based security. Problem solved.

Side note: I encountered another problem that was actually caused by this particular fix. The problem had to do with connecting to another server from the app server, specifically Sql Server. I’ll post this scenario and how I fixed it later.

Powered by WordPress