Debug Error with Google Adsense Code
After I embedded the Google AdSense code in my web pages and started to debug my website using Visual Studio Express 2005, I got the following error,
Microsoft JScript runtime error: Error in loading DLL
The line of code is in Show_ads.js:
{var b=c.GetVariable("$version").split(" ")[1];return b.
According to other posts online, I suspect that the problem is the domain name I am using for my development environment. The full URL becomes "http://localhost:59517/Default.aspx". However, I could not find the option to set the domain name for debug using Visual Studio.
In order to fix the problem, I put all the Google AdSense code in div and added following code to remove the Google AdSense during development stage. It can also ensure I won't click on any ads during my debug.
string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ip == string.Empty || ip == null)
{
ip = Request.ServerVariables["REMOTE_ADDR"];
}
if (ip.CompareTo("127.0.0.1") == 0)
{
this.div_Main_Google_AdSense.InnerHtml = "";
this.div_RightAdsense.InnerHtml = "";
}
I may need to add this feature to my production website with a list of IP configured through Admin page so that at least I won't have the Google Ads displayed when I am working on the site myself. The cost is that the code will slow down the server a little bit. Do you think it worthwhile?
Microsoft JScript runtime error: Error in loading DLL
The line of code is in Show_ads.js:
{var b=c.GetVariable("$version").split(" ")[1];return b.
According to other posts online, I suspect that the problem is the domain name I am using for my development environment. The full URL becomes "http://localhost:59517/Default.aspx". However, I could not find the option to set the domain name for debug using Visual Studio.
In order to fix the problem, I put all the Google AdSense code in div and added following code to remove the Google AdSense during development stage. It can also ensure I won't click on any ads during my debug.
string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ip == string.Empty || ip == null)
{
ip = Request.ServerVariables["REMOTE_ADDR"];
}
if (ip.CompareTo("127.0.0.1") == 0)
{
this.div_Main_Google_AdSense.InnerHtml = "";
this.div_RightAdsense.InnerHtml = "";
}
I may need to add this feature to my production website with a list of IP configured through Admin page so that at least I won't have the Google Ads displayed when I am working on the site myself. The cost is that the code will slow down the server a little bit. Do you think it worthwhile?
If you're looking for a solid contextual ad company, I recommend that you check out Clicksor.
ReplyDelete