Site Meter Asp.Net-Csharp,Asp,Ado.Net,Ado,Micosoft,Visualstudio,Visual webgui: November 2009

Thursday, November 26, 2009

Find client and server ip address in,C#.

Find client and server ip address in,C#.

To get Server IP Address and Name(ie)where your domain hosted in an server:

1. string strHostName = System.Net.Dns.GetHostName();
2. string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();

To get Client IP address ie system current IP address:


Your IP address is:

The DNS lookup of the IP address is:

The method used to call the page:

The server's domain name:

The server's port:

The server's software:

Sunday, November 22, 2009

Download application or word or doc or pdf code in,c#

Download application or word or doc or pdf code in,c#
if (Page.IsPostBack){

Response.AddHeader( "content-disposition","attachment; filename=RegistrationFormDownload.pdf");
//Source from server
FileStream sourceFile = new FileStream(@"c:\inetpub\vhosts\\httpdocs\Form.pdf", System.IO.FileMode.Open,System.IO.FileAccess.Read, System.IO.FileShare.Read );
//Source from Local system
FileStream sourceFile = new FileStream(@"system file path", System.IO.FileMode.Open,System.IO.FileAccess.Read, System.IO.FileShare.Read );
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);


Saturday, November 21, 2009

Differences::::Div vs span vs iframe

Differences::::Div vs span vs iframe

Blogger wont allow HTML content you can get full article which is given below from this link.You can download it..

DIV is short for "division" because it divides elements.

span is inline, div a block.span is permitted in a div, but not div in a span.

The main difference is that span element is in-line and usually used for a small chunk of in-line HTML whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.

is a block level element -- it's going to 100% width, and it will line break - and is best used for structure (stands for 'division' -- semantic markup here!)
is inline, it can go next to other elements and is best used for text editing... adding rules to special text in a paragraph, hiding text (like navigation), etc.


The div tag has forced a line break.
The div tag will force a line break.
The div tag has forced a line break.The span tag does not force a line break. There is no line break.

Reference to div tag properties::::

IFrame and Div are HTML tags. They are only for the layout purposes. Using IFrame, you can view another html file in your main html.
Div is used to display contents in a html page. You can put some text,image, and/or combination to display in a div.

An iframe is like having a hole on your page, and in that hole is another web page. If that page is clicked ONLY that page will refresh so that the rest of the site appears to stay in the same place. It's not valid HTML and is therefore not encouraged because browsers can interpret iframes however they want. An iframe is only a container and the page that goes inside it still needs to be written as usual.

To get small idea to get what is div tag

#framearea {
width: 550px;
height: 150px;
margin-bottom: 10px;
.framebody {
overflow: auto;
width: 550px;
height: 150px;

...content here...

Using a DIV as variable to write into IFRAME

Saturday, November 14, 2009

Installing windows Azure ,

Installing windows Azure SDK7

IIS 7.0 has to be configured in Vista.8
ASP.NET Application Development components installed.2

WPIlauncher install(Microsoft Web Platform Installer 2.0 Beta)4

Click on the Web Platform tab and customize the Web Server option with:
ASP.Net, Default Document and CGI (if you want to run fastCGI apps)

Click “Install” when you are ready. You’ll get an opportunity to review your selection,
then the download and install will commence.

Finally, if you are using WCF, you will want to install WCF HTTP Activation. (this is a .Net feature)

On Vista: From the Start menu, choose Settings | Control Panel | Programs | Programs and Features,
Click Turn “windows Features On or Off”, under Microsoft .Net Framework 3.0, select WCF HTTP Activation

On Windows Server 2008 – In Server Manager under Features Summary, choose Add Features – under .Net Framework 3.0 Features, select WCF Activation.

Install the Windows Azure Tools

What is Localization,Resource,resx in,C#.

Please refer the following sites to get idea about What is Localization,Resource,resx in,C#. Resource file .resx) localize) for localize and resource file)

To retrieve table data using table column in,C#

SqlDataReader rdr = null;
SqlConnection sqlcon = new SqlConnection("Server=___;Initial Catalog=____;Integrated security=true");

SqlCommand cmd1 = new SqlCommand("select * from ____;", sqlcon);
rdr = cmd1.ExecuteReader();
while (rdr.Read())
string ___ = rdr.GetString(rdr.GetOrdinal("column name"));
string ___ = rdr.GetString(rdr.GetOrdinal("column name"));


Substring in,c#

To find the last character in a string
string lastCharacter = myString.Substring(myString.Length - 1, 1);
//i.e. the last character is a SubString of myString, one character long, starting one character short of the length of myString

To remove the last two characters of a string
string myNewString = myString.Substring(0, myString.Length - 2);
//i.e. the new string is a SubString 2 characters shorter than myString, starting at the beginning of myString