Learning Curve…

Archive for the ‘Interview questions and answers’ Category

 

ASP.NET 4.0 supports built in support for URL Routing. This can make site more user friendly and site content more discoverable by search engines. It is also easy to remember and while bookmarking.

Following example shows URL without using Routing mechanism of ASP.NET 4.0.

http://website/products.aspx?categoryid=12

After using Routing mechanism of ASP.NET 4.0, above URL becomes as follow.

http://website/products/software

For mapping above URL to the list of products based on category, we need to map our route using new method MapPageRoute of class Route as shown in following examples.
Application_Start(object sender, EventArgs e)   {
     RouteTable.Routes.MapPageRoute(“ProductsRoute”,
         “product/{prodId}”, “~/products.aspx”);
}

 

Advertisements
  1. Range variable: – A variable defined in your LINQ query that is subsequently used in the select and where parts.
  2. Strong typing: – A programming concept where the type of a variable is explicitly defined when the variable is declared.
  3. Type inference: – A technique where the compiler determines the type of a variable based on the data it gets assigned. This enables you to create strongly typed variables without explicitly defining the variable’s type first
  4. Lazy loading: – A technique where data is not loaded from the database until it is accessed at runtime.
  5. Anonymous types:-Types that are created on-the-fly without defining them explicitly.

Eval is one-way, read only databinding.

Bind is two-way, read/write databinding.

You can check if constraints exist in a column in sql server  and if its not there you can alter table to add a constraint using below query :-

IF NOT EXISTS (SELECT  *  FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ConstraintsName]’))
    ALTER TABLE [dbo].[TableName] ADD  CONSTRAINT [ConstraintsName]  DEFAULT (newid()) FOR [ContactID]
GO

Happy Coding !!!

Concept of Application pool has from IIS 6.0 .
Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries. Application pools used to isolate our web application for better security, reliability, and availability and performance and keep running with out impacting each other . The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected.
One Application Pool can have multiple worker process Also.

Main Point to Remember:
1. Isolation of Different Web Application
2. Individual worker process for different web application
3. More reliably web application
4. Better Performance

Visual studio having its own ASP.NET Engine which is capable enough to run Asp.net web application from visual studio. So we just click on Run button to start the application.
Now this is the scenarios of local environment. But If we want to host it on server from where all user can access the sites then IIS comes into the picture.

IIS provides a redesigned WWW architecture that can help you achieve better performance, reliability, scalability, and security for our Web sites. IIS can support different Protocol such as HTTP /HTTPS, FTP, FTPS, SMTP Etc. We need to host the site on IIS, when request comes from client it first hits the IIS Server, then the server passed it to ASP.NET worker process to execute. Then the response also passes to client via IIS itself.

Tags:

An anonymous type is a type whose name you don’t define up front like you do with other types such as classes. Instead, you construct the anonymous type by selecting data and then let the compiler infer the type for you.

Creating an anonymous type is easy; instead of selecting the actual object using something like Select TableName, you use the new keyword in C# and New With in Visual Basic and then define the properties you want to select between a pair of curly braces:

For example:-

var varName= from r in tableName

select new { r.Id, r.Title};

Although the type is anonymous and cannot be accessed by name directly, the compiler is still able to infer the type, giving you full IntelliSense for the new properties that were selected in the query.

Besides directly selecting existing properties — as shown in the query that selected the Id, and Title, you can also make up property values and give them different names as you go.

For example, the following query creates a new anonymous type that renames the Id as

Number, limits the Title to the first 20 characters, and contains a Boolean value that determines whether the item has been updated in the database previously:

var varName = from r in tableName

Select new

{

Number = r.Id,

Title = r.Title.Substring(0, 20),

HasBeenUpdated = (r.UpdateDateTime >

r.CreateDateTime)

};


Author

Learning days (Calendar)

October 2017
M T W T F S S
« Jun    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 510,411 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: