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

Wednesday, February 3, 2010

what is localization and globalization in asp.net

what is localization and globalization in asp.net

Globalization is the process of designing and developing applications that function for multiple cultures. Localization is the process of customizing your application for a given culture and locale.

Create a Multi-Lingual Site with Localization and Globalization in asp.net

Clear example in video: http://www.asp.net/%28S%28ywiyuluxr3qb2dfva1z5lgeg%29%29/learn/videos/video-40.aspx

Create a Multi-Lingual in windows form application c#,winforms,c .net

Clear example step by step: http://msdn.microsoft.com/en-us/library/y99d1cd3(VS.80).aspx

Friday, December 11, 2009

Overview and example for Datatable in asp.net

Overview and example for Datatable in asp.net:


MEthod 1:


DataTable cTable = new DataTable();
DataRow d3;

cTable.Columns.Add("A", typeof(string));
cTable.Columns.Add("B", typeof(string));
cTable.Columns.Add("C", typeof(string));

d3 = cTable.NewRow();
d3[0] = "A:";
d3[1] = B;
d3[2] = "C";

cTable.Rows.Add(d3);


Method 2:

DataTable dtProducts = new DataTable();
DataColumn productColumn = new DataColumn();

productColumn.DataType = System.Type.GetType("System.Int32");
productColumn.ColumnName = "id";
productColumn.Unique = true;
dtProducts.Columns.Add(productColumn);


DataTable dtProducts = createProductDT();

DataRow aProduct = dtProducts.NewRow();

aProduct["id"] = 11;
aProduct["thumb"] = "images/widget0.jpg";
aProduct["name"] = "Red Widget";
aProduct["price"] = 19.99;
dtProducts.Rows.Add(aProduct);

Wednesday, December 9, 2009

Types,Modes,Differences of session in asp.net

Overview of session modes and types in asp.net:

Normally http protocol is stateless to maintain state following namespace is used.

System.Web.SessionState.HttpSessionState

Modes And's Provider:

Session State Mode State Provider

InProc In-Memory Object
StateServer Aspnet_state.exe
SQLServer DataBase
Custom CustomProvider

Session Event's:

There are two types of session events available in asp.net

* Session_Start
* Session_End


Types:

1.inproc Mode (ie inprocess)--->Its availble inside the webserver itself not ouside the application.
2.StateserverMode(ie out process) -->Its availble outside the webserver,not inside the application.
3.sqlserver Mode -->To store session datas in sqlserver.AND DATAS CAN BE SHARED BETWEEN OTHE APPLICATIONS.
4.Custom Mode --> To create a manual session id's.



1.inproc Mode

Advantages :

* It store Session data in memory object of current application domain. So accessing data is very fast and data is

easily available.
*Datas not alive when application restarted.
* There is not requirements of serialization to store data in InProc Session Mode.
* Implementation is very easy, just similar to using View State.

DisAdvantage:

If the worker Process or application domain recycles all session data will be lost.


2.StateserverMode

This session state is totally managed by aspnet_state.exe.

This approaches has several disadvantages due to the overhead of serialization and de-serialization.

Datas will be alive it the aspnet services restarted also.


3.sqlserver Mode

The most easiest way to configure SQL Server, is using aspnet_regsql command.

4.Custom Mode --> To create a manual session id's.

Thursday, November 26, 2009

Find client and server ip address in asp.net,C#.

Find client and server ip address in asp.net,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:

1.Response.Write(Request.ServerVariables["http_user_agent"].ToString());

Your IP address is:
2.Response.Write(Request.ServerVariables["remote_addr"].ToString());

The DNS lookup of the IP address is:
3.Response.Write(Request.ServerVariables["remote_host"].ToString());

The method used to call the page:
4.Response.Write(Request.ServerVariables["request_method"].ToString());

The server's domain name:
5.Response.Write(Request.ServerVariables["server_name"].ToString());

The server's port:
6.Response.Write(Request.ServerVariables["server_port"].ToString());

The server's software:
7.Response.Write(Request.ServerVariables["server_software"].ToString());

Sunday, November 22, 2009

Download application or word or doc or pdf code in asp.net,c#

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

Response.ContentType="application/ms-word";
Response.AddHeader( "content-disposition","attachment; filename=RegistrationFormDownload.pdf");
//Source from server
FileStream sourceFile = new FileStream(@"c:\inetpub\vhosts\www.com\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);
sourceFile.Close();

Response.BinaryWrite(getContent);
}

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.. http://www.4shared.com/file/156448190/930b924a/div_vs_frame_vs_span.html


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.

Eg;;

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:::: http://www.searchwin.net/spandiv.htm


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


http://www.devarticles.com/c/a/HTML/The-power-of-DIV-with-IFRAME/

Saturday, November 14, 2009

Installing windows Azure ,

Installing windows Azure SDK7

Prerequist:2
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

http://www.microsoft.com/downloads/details.aspx?FamilyID=8d75d4f7-77a4-4adf-bce8-1b10608574bb&displaylang=en

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

Please refer the following sites to get idea about What is Localization,Resource,resx in asp.net,C#.


http://www.c-sharpcorner.com/UploadFile/prasham/RESOURCEFILES02132008080733AM/RESOURCEFILES.aspx(About Resource file .resx)

http://www.codeproject.com/KB/aspnet/LocalizationPackage.aspx(about localize)

http://www.west-wind.com/presentations/wwDbResourceProvider/introtolocalization.aspx(Example for localize and resource file)

To retrieve table data using table column in asp.net,C#

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

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"));

}
sqlcon.Close();

Substring in asp.net,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