8.19.2012

ASP.NET Difference FAQs-10

1.Difference between Invoke() and BeginInvoke()
S.No
Invoke()
BeginInvoke()
1
Delegate.Invoke:

Executes synchronously, on the same thread.
Delegate.BeginInvoke:

Executes asynchronously, on a threadpool thread.
2
Control.Invoke:

Executes on the UI thread, but calling thread waits for completion before continuing.
Control.BeginInvoke:

Executes on the UI thread, and calling thread doesn’t wait for completion.
2.Difference between Build and Release
S.No
Build
Release
1
BUILD is still running in testing that is released to testers for testing
RELEASE is no longer with testing and release to Customers/Clients.
2
BUILD occur more frequently
RELEASE occur less frequently.
3
BUILD is process of converting source code in to executable
code (.exe)
RELEASE is a process of delivering the project to client
3.Difference between Windows forms and Web forms
S.No
Windows forms
Web forms
1
They do not need a web browser or web server to execute.
They need a web browser as well as a web server(on the server machine only).
2
They execute through their respective exe files

They execute through the dll of the web application which is then processed by IIS and the .net framework.
3
They run on the same machine they are displayed on.
They run on a remote server and are displayed remotely on the clients
4
Their single instance exists until we close them or dispose them through coding
Every time they are submitted, their new instance is created.

5
Used for developing games, inventory management, system utiltites etc.
Used in web site development.

6
They run under Code Access Security.
They use role based security

4.Difference between Master Page and Content Page in ASP.NET
S.No
Master Page
Content Page
1
Files with .Master extension. Introduced in ASP.NET 2.0.

Example:

code file: .master.cs or .master.cs extension
Files with .aspx extension.

Example:

Code file: .aspx.cs or .aspx.vb
2
These have a control known as the Content Placeholder which reserves a storage location in which we can place the contents of a .aspx page.

The common part for the .aspx pages will be outside the Content Placeholder two Content Placeholders are by default, but we can increase or decrease the Content Placeholders as per our needs.
These do not have any Content Placeholder control which makes it somewhat difficult in providing proper layout and alignment for large designs.
3
MasterPageFile attribute is added in the Page directive of the .aspx page when a Master Page is referenced in .aspx page. The .aspx page that uses the Master page i known as Content Page.
Register Tag is added when we drag and drop a user control onto the .aspx page.
4
Can be referenced using Web.Config file also or dynamically by writing code in PreInit event.
Can be attached dynamically using Load Control method. PreInit event is not mandatory in their case for dynamic attachment.
5
More suitable for large designs(ex: defining the complete layout of .aspx page)
Suitable for small designs(Ex:1) logout button on every .aspx page.


Sample Code For Master Page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
       
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>



Sample Code For Content Page
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>

No comments:

Post a Comment