Subhash Sharma

Subhash Sharma
Subhash Sharma

This is Subhash Sharma(Software Engineer) Blog

Welcome to this blog and find every solution.............

Search This Blog

Software Engineer(Subhash Sharma)

Software Engineer(Subhash Sharma)
Software Engineer

Wednesday, February 16, 2011

What is difference between Physical path and Virtual path?

Physical path is the path where ur original application has
stored(actual directory path of application).

virtual path is the link between physical path and
IIS..becoz to execute the webapplication in Physical
path,it needs to be mapped on to IIS(webserver) and this
logical link between physical path and IIS is called
virtual path

Recursive method for Find all directory and inside the directory found all files

// Insert logic for processing found files here.
public static void ProcessFile(string path)
{
//Logic here in file
}

// Process all files in the directory passed in, recurse on any directories
// that are found, and process the files they contain.
public static void ProcessDirectory(string targetDirectory)
{
// Process the list of files found in the directory.
string[] fileEntries = Directory.GetFiles(targetDirectory);
foreach (string fileName in fileEntries){
ProcessFile(fileName);
}


// Recurse into subdirectories of this directory.
string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory);
foreach (string subdirectory in subdirectoryEntries)
{
ProcessDirectory(subdirectory);

}
}

//call the Method

string FilePath = Request.PhysicalApplicationPath + "UploadFile";
if (Directory.Exists(FilePath))
{
ProcessDirectory(FilePath);

}

Tuesday, February 15, 2011

What is the difference between WCF Service and Web Service?

What is the difference between WCF Service and Web Service?

a)WCF Service supports both http and tcp protocol while webservice supports only http protocol.
b)WCF Service is more flexible than web service.

•Web services can be hosted in IIS as well as outside of the IIS. While WCF service can be hosted in IIS, Windows activation service,Self Hosting,WAS and on lots of proctols like Named Pipe,TCP etc.Here lots of people disagree how we can host the web service outside of the IIS but Here is the article for that.http://msdn.microsoft.com/en-us/library/aa529311.aspx.

•In Web Services Web Service attribute will added on the top of class. In WCF there will be a Service Contract attributes will be there. Same way Web Method attribute are added in top of method of Web service while in WCF Service Operation Contract will added on the top method.

•In Web service System.XML.Serialization is supported while in the WCF Service System.RunTime.Serialization is supported.

•WCF Services can be multithreaded via ServiceBehavior class while web service can not be.

•WCF Services supports different type of bindings like BasicHttpBinding, WSHttpBinding, WSDualHttpBinding etc.while Web services only used soap or xml for this.

•Web services are compiled into a class library assembly. A file called the service file is provided that has the extension .asmx and contains an @ WebService directive that identifies the class that contains the code for the service and the assembly in which it is located while in WCF.WCF services can readily be hosted within IIS 5.1 or 6.0, the Windows Process Activation Service (WAS) that is provided as part of IIS 7.0, and within any .NET application. To host a service in IIS 5.1 or 6.0, the service must use HTTP as the communications transport protocol.

Monday, February 14, 2011

View state Data stored?

Where is the View state Data stored?
ViewState data is stored in the hidden field. When the page is submitted to the server the data is sent to the server in the form of hidden fields for each control. If th viewstate of the control is enable true the value is retained on the post back to the client when the page is post backed

candidate key, alternate key, composite key.

■Define candidate key, alternate key, composite key.
■A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys. A key formed by combining at least two or more columns is called composite key.

Session

InProc means where the session variable will be stored in the procesor .
OutProc are the session modes like Stateserver and Sqlserver
In Stateserver session variables are stored in application domain
In Sqlserver session mode session variable is stored in sql server


The StateServer mode uses a stand-alone Microsoft Windows service that is independent of IIS and can run on a separate server.
In this case the session state is serialized and stored in memory in a separate process that is managed by the aspnet_state.exe file.
This has got some performance drawbacks due to the overhead involved in serialization and de-serialization of objects.
The main primary advantage of storing the Session State in a State Server is that it is not in the same process as the ASP.NET and a crash of ASP.NET
would in no way destroy the session data. Secondly, this mode of Session State storage enables to share the information across a web garden or a web farm.

Rememeber that this mode is slow compared to the InProc mode as it is stored in an external process

Session default Expiration

Session default Expiration : is 20 Minute