Publish Article
Google AdSense Control For ASP.Net - GSense.Net

These days a lot of web sites are part of google's adsense affiliate program. And Netomatix site is no exception to it. I think its a decent affiliate program and gives a chance to editors to earn revenue for the content they have been publishing for the community.

Lately I have been getting quite a few requests from the site users that they would like to see an ASP.Net control that would allow them to add Google Adsense for Content and AdSense Links advertisements by simple drag-drop of a control and configure the appearance using the Visual Studio IDE which they are used to doing for other controls. And we also felt the same way since we had to go back and forth to google site to get new script every time we wanted to change the appearance or channel etc.

GSense.Net is our attempt to create a custom ASP.Net control for this very purpose. This is first release of the control so it kind of lacks some bells and whistles especially in design time mode. But for run time mode it accomplishes everything you would do by pasting script from google's site on to your page.


You have to have google affiliate account to start streaming ads on your site. If you do not have one, please click on the following link to open an account. Google does not charge any money for opening an account.

Properties To Configure

  • AffiliateId: This is affiliate id that google assigned to you or your bussiness when you signed up for the account. This property has to be set for the control to work otherwise an application exception will be thrown at run time. Design time mode does not check for this property. This id usually starts with "pub-". If you do not have one, click on the image link as mentioned in previous section.
  • ChannelId: If you are tracking your clicks based on channels that you created, then specify this property. This property is optional.
  • AdUnitFormat: You can specify the format of the ad unit which controls the width and height of banner and also orientation of the banner.
  • LinkUnitFormat: This is same as AdUnitFormat property but is used for Link type ads only.
  • TextColor, LinkColor, BorderColor, UrlColor, BackColor: As names suggests these properties can be specified to control appearnce of the ads and the banner.

You can specify all the above properties from Property View of Visual Studio IDE as shown below.

How to use

We are providing source code as well as binaries for the control. Compile the source and it will generate Winista.GoogleAdUnit assembly. Add reference to this assembly in your project. Then follow the steps as described below:

  • Add Register tag at top of your page.

<%@ Register TagPrefix="wwc" Namespace="Winista.GoogleAdUnit" Assembly="Winista.GoogleAdUnit" %>
  • And put the control on your page.

<wwc:AdUnit runat="server" id="ctlLeaderAdUnit" 
  • Configure the appearance of ads from property view.


This control is provided free of cost to use on your site. If you would like to donate some money to our site to help development efforts, we would appreciate that.

Support GSense.Net

Download Source For Control

If you are seeing this section and do not see source code download links, this means that you are not logged into our site. If you already are a memeber, click on the login link and login into site and come back to this page for downloading the control files. If you are not a member, click on registration link to become a Winista member and download the control for free.

Go Freelance
Home     About us     Contact us    Copyright    Privacy Policy    Return Policy    Advertisers
Copyright © Netomatix