Sunday, October 30, 2011

How to fix missing session in iframe using ASP.NET

When you face missing session in iframe, it can solve with the following code:

Response.AppendHeader("P3P", "CP=\"CAO PSA OUR\"");

You put the above code in Page Load event. That's it.

How to check the string whether integer or not?

When you want to check strings as integer, you can use the following code easily:

private
bool checkDigit(string s)

{

System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex("^([0-9]+)$");

return (re.Matches(s).Count > 0);

}

How to get web site url in asp.net


When you want to get one web site url such as http://www.iblogseeker.com/register.aspx, use the following code:
 
public string GetSiteUrl()
{
string baseUrl = null;
HttpContext c = HttpContext.Current;
if (c != null)
{
string port = c.Request.ServerVariables["SERVER_PORT"];
if (port == null || port.Equals("80") || port.Equals("443"))
port = String.Empty;
else
port = ":" + port;
string protocol = c.Request.ServerVariables["SERVER_PORT_SECURE"];
if (protocol == null || protocol.Equals("0"))
protocol = "http://";
else
protocol = "https://";
baseUrl = protocol + c.Request.ServerVariables["SERVER_NAME"] + port + c.Request.ApplicationPath;
}
return baseUrl;
}

It covers any url in active on web.

Monday, June 8, 2009

AdSense for domains

What is AdSense for domains?

AdSense for domains allows publishers with unused domains to help users reach relevant information by presenting content on the domains.

Users often type domains into their address bar or follow expired links leading to sites with no content. Instead of an "under construction" page or 404 error, AdSense for domains provides links, search results, advertisements and other content. To do this, we use semantic technology targeted to the domain name. You earn revenue when users interact with the ads on your site.

If you have a site that has content on it (e.g., articles, reviews, forums, blog postings or other text), then your site should be used with AdSense for content. If you have a page with no content on it, then AdSense for domains can help your users. To get started with AdSense for domains, check out our set-up instructions, or search or browse our AdSense Help Forum for more information.

AdSense for domains

Use the Google Chart API to create charts for your web applications

With the Google Chart API you can build a URL that will dynamically create a chart for you. This service is used internally for Google Finance, Google Video, and beyond. Now, anyone can use it!

Although it is simple to use (just a darn URL after all) you will see that there are many options.

Here is just a few charts to show how broad this is:

Line Chart

http://chart.apis.google.com/chart?cht=lxy&chs=200×125&chd=t:0,30,60,70,90,95,100|20,30,40,50,60,70,80|10,30,40,45,52|100,90,40,20,10|-1|5,33,50,55,7&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5

Bar Charts

http://chart.apis.google.com/chart?cht=bvg&chs=200×125&chd=s:hello,world&chco=cc0000,00aa00

Pie Charts

http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=200×100&chl=Rails|PHP|Java|.NET

Venn Diagrams

http://chart.apis.google.com/chart?cht=v&chs=200×100&chd=t:100,80,60,30,30,30,10

Scatter

http://chart.apis.google.com/chart?cht=s&chd=s:984sttvuvkQIBLKNCAIi,DEJPgq0uov17zwopQODS,AFLPTXaflptx159gsDrn&chxt=x,y&chxl=0:|0|2|3|4|5|6|7|8|9|10|1:|0|25|50|75|100&chs=200×125

Solid Fill

http://chart.apis.google.com/chart?cht=lc&chd=s:pqokeYONOMEBAKPOQVTXZdecaZcglprqxuux393ztpoonkeggjp&chco=FF0000&chls=4.0,3.0,0.0&chs=200×125&chxt=x,y&chxl=0:|Jun|July|Aug|1:||20|30|40|50&chf=bg,s,efefef