Wednesday, May 12, 2010

Asp.net Questions and Answers

What is the difference between login controls and Forms authentication?

Latest answer: Login control provides form authentication. If we implement for authentication through form authentication then we do it through code. On the other hand, login control allows the easy implementation...............
Read answer
What is Fragment Caching in ASP.NET?

Latest answer: Fragment caching allows to cache specific portions of the page rather than the whole page. It is done by implementing the page in different parts............
Read answer
What is partial classess in .net?

Latest answer: When there is a need to keep the business logic separate from the User Interface or when there is some class which is big enough to have multiple number of developers............
Read answer
Explain how to pass a querystring from an .asp page to aspx page.

Latest answer: FromHTMLinasppage:Test Query String
From server side code: <%response.redirect "webform1.aspx?id=11"%>...............
Read answer
What is a ViewState?

Latest answer: If a site happens to not maintain a ViewState, then if a user has entered some information in a large form with many input fields and the page is refreshes, then the values filled up in the form are lost...........
Read answer
What is the difference between src and Code-Behind?

Latest answer: With the ‘src’ attribute, the source code files are deployed and are compiled by the JIT as needed.
Though the code is available to everyone with an access to the server (NOT anyone on the web)................
Read answer
What is the difference between URL and URI?

Latest answer: A URL (Uniform Resource Locator) is the address of some resource on the Web. A resource is nothing but a page of a site. There are other type of resources than Web pages, but that's the easiest conceptually...........
Read answer
What is the Pre-Compilation feature of ASP.NET 2.0?

Latest answer: Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so as to make the requests to access the page extremely efficient............
Read answer
How can we create custom controls in ASP.NET?

Latest answer: Custom controls are user defined controls. They can be created by grouping existing controls, by deriving the control from System.Web.UI.WebControls..........
Read answer
What is an application domain?

Latest answer: It's a way in CLR to maintain a boundary between various applications to ensure that they do not interfere in working of any other application...........
Read answer
Explain the two different types of remote object creation mode in .NET. [Hint SAO and CAO]

Latest answer: SAO Server Activated Object (call mode): lasts the lifetime of the server. They are activated as SingleCall/Singleton objects. It makes objects stateless...........
Read answer
Describe SAO architecture of Remoting.

Latest answer: Remoting has at least three sections:-

1. Server
2. Client: This connects to the hosted remoting object
3. Common Interface between client and the server .i.e. the channel..........
Read answer
Explain Singleton architecture of Remoting.

Latest answer: Singleton architecture is to be used when all the applications have to use or share same data...........
Read answer
Define LeaseTime, SponsorshipTime, RenewOnCallTime, LeaseManagePollTime.

Latest answer: The LeaseTime property protects the object so that the garbage collector does not destroy it as remoting objects are beyond the scope of the garbage collector. Every object created has a default leasetime for which it will be activated..........
Read answer
Briefly explain how to specify remoting parameters using config files.

Latest answer: The remoting parameters can be specified through both programming and in config files. All the settings defined in config files are placed under ...........
Read answer
What is marshalling? Explain types of marshalling.

Latest answer: Marshaling is a process of transforming or serializing data from one application domain and exporting it to another application domain...........
Read answer
What is ObjRef object in remoting?

Latest answer: ObjRef is a searializable object returned by Marshal() that knows about location of the remote object, host name, port number, and object name........
Read answer
Explain the steps of acquiring a proxy object in web services.

Latest answer: Every service listed has a URI pointing to the service's DISCO or WSDL document, which is needed to access the webservice and its 'webmethod" methods..........
Read answer
Explain the steps to create a web services and consume it.

Latest answer: Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()"........
Read answer
Explain the difference between cache object and application object.

Latest answer: Application Object: Application variable/object stores an Object with a scope of availability of the entire Application unless explicitly destroyed.............
Read answer
What is Cache Callback in Cache?

Latest answer: The cache object has dependencies e.g. relationships to the file it stores. Cache items remove the object when these dependencies change. As a work around we would need to simply execute a callback method............
Read answer
What is Scavenging?

Latest answer: A process where items are removed from cache in order to free the memory based on their priority. A property called "CacheItemPriority" is used to figure out the priority of each item inside the cache...........
Read answer
Explain the types of Caching using Cache object of ASP.NET.

Latest answer: Page output: Is used to fetch information or data at page level. It is best used when the site is mainly static. Used by declaring the output page directive............
Read answer
Show with an example how to Cache different version of same page using ASP.NET Cache object.

Latest answer: The ways to cache different versions on the same page using ASP.NET cache object is using OutputCache object............
Read answer
Explain how to implement Fragment Cache.

Latest answer: Fragment cache is to store user controls individually within a web form in cache instead of the whole webform as such. The idea is to simply have different cache parameters for different user controls.............
Read answer
Explain the various modes of storing ASP.NET session.

Latest answer: Types of sessions: InProc: The default way to use sessions. InProc is the fastest way to store and access sessions...........
Read answer
What are the benefits and limitations of using hidden fields?

Latest answer: Advantages: Easy to implement, Hidden fields are supported by all browsers, Enables faster access of information because data is stored on client side............
Read answer
What are the benefits and limitations of using Hidden Frames?

Latest answer: Advantages: Hidden frames allow you to cache more than one data field, The ability to cache and access data items stored in different hidden forms...........
Read answer
What are benefits and limitations of using Cookies?

Latest answer: Advantages: They are simple to use. Light in size, thus occupy less memory. Stores server information on client side. Data need not to be sent back to server........
Read answer
What is QueryString and what are benefits and limitations of using querystring?

Latest answer: Querystring is way to transfer information from one page to another through the URL........
Read answer
What is Absolute and Sliding expiration in .NET?

Latest answer: Absolute and sliding expiration are two Time based expiration strategies. Absolute Expiration: Cache in this case expires at a fixed specified date or time..............
Read answer
Explain the concepts and capabilities of cross page posting.

Latest answer: Cross-page posting is done at the control level. It is possible to create a page that posts to different pages depending on what button the user clicks on. It is handled by done by changing the postbackurl property of the controls..........
Read answer
Explain how to access ViewState value of this page in the next page.

Latest answer: PreviousPage property is set to the page property of the nest page to access the viewstate value of the page in the next page. Page poster = this.PreviousPage;..........
Read answer
What is SQL Cache Dependency in ASP.NET?

Latest answer: SQL Cache Dependency in ASP.NET: It is the mechanism where the cache object gets invalidated when the related data or the related resource is modified.........
Read answer
Explain the concepts of Post Cache Substitution in .NET

Latest answer: Post Cache Substitution: It works opposite to fragment caching. The entire page is cached, except what is to be kept dynamic. When [OutputCache] attribute is used, the page is cached............
Read answer
Explain the use of localization and Globalization.

Latest answer: Users of different countries, use different languages and others settings like currency, and dates. Therefore, applications are needed to be configurable as per the required settings based on cultures, regions, countries........
Read answer
Explain the concepts of CODE Page approach. What are the disadvantages of this approach?

Latest answer: Code Page was used before Unicode came into existence. It was a technique to represent characters in different languages..........
Read answer
What are resource files and explain how do we generate resource files?

Latest answer: Resource files are files in XML format. They contain all the resources needed by an application. These files can be used to store string, bitmaps, icons, fonts........
Read answer
What are Satellite assemblies and how to generate Satellite assemblies?

Latest answer: To support the feature of multiple languages, we need to create different modules that are customized on the basis of localization. These assemblies created on the basis of different modules are knows as satellite assemblies...........
Read answer
Define AL.EXE and RESGEN.EXE.

Latest answer: Al.exe: It embeds the resources into a satellite assembly. It takes the resources in .resources binary format.......
Read answer
Explain the concepts of resource manager class.

Latest answer: ResourceManager class: It provides convenient access to resources that are culture-correct. The access is provided at run time.........
Read answer
What is Windows communication foundation, WCF?

Latest answer: WCF is a framework that builds applications that can inter-communicate based on service oriented architecture consuming secure and reliable web services.............
Read answer
Explain the important principle of SOA.

Latest answer: A service-oriented architecture is collection of services which communicate with one another other......
Read answer
Explain the components of WCF - Service class, Hosting environment, END point.

Latest answer: WCF Service is composed of three components: Service class: It implements the service needed, Host environment: is an environment that hosts the developed service.............
Read answer
Difference between WCF and Web Services.

Latest answer: WCF can create services similar in concept to ASMX, but has much more capabilities. WCF is much more efficient than ASP.Net coz it is implemented on pipeline............
Read answer
What are different bindings supported by WCF?

Latest answer: BasicHttpBinding, WSHttpBinding, WSDualHttpBinding.......
Read answer
What is duplex contract in WCF?

Latest answer: Duplex contract: It enables clients and servers to communicate with each other. The calls can be initiated independently of the other one.............
Read answer
Explain the different transaction isolation levels in WCF.

Latest answer: Read Uncommitted: - Also known as Dirty isolation level. It makes sure that corrupt Data cannot be read. This is the lowest isolation level............
Read answer
What are Volatile and Dead letter queues?

Latest answer: Volatile Queues: There are scenarios in the project when you want the message to deliver in proper time. The timely delivery of message is very more important and to ensure they are not lost is important too. Volatile queues are used for such purposes.............
Read answer
What is Windows workflow foundation?

Latest answer: Windows Workflow Foundation (WF): It is a platform for building, managing and executing workflow-enabled applications, for designing and implementing a programming model ..........
Read answer
Explain the types of Workflow in Windows Workflow Foundation.

Latest answer: There are 3 types of workflows in WWF: Sequential Workflow: The sequential workflow style executes a set of contained activities in order, one by one and does not provide an option to go back to any step...........
Read answer
What are XOML files? Explain their uses.

Latest answer: XOML is an acronym for Extensible Object Markup Language. XOML files are the markup files. They are used to declare the workflow and are then compiled with the file containing the implementation logic..............
Read answer
How to make an application offline in ASP.NET 2.0.

Latest answer: Microsoft's Internet Information Services web server software is used to make an application offline. The IIS is instructed to route all incoming requests for the web site to another URL automatically........
Read answer
What are script injection attacks?

Latest answer: Script injection attacks called Cross-site scripting (XSS) attacks exploit vulnerabilities in Web page validation by injecting client-side script code.............
Read answer
What is Authentication in ASP.NET?

Latest answer: Authentication is the process of verifying user’s details and find if the user is a valid user to the system or not. This process of authentication is needed to provide authority to the user........
Read answer
What is Authorization in ASP.NET?

Latest answer: Authorization is a process that takes place based on the authentication of the user. Once authenticated, based on user’s credentials, it is determined what rights des a user have...........
Read answer
What is the difference between login controls and Forms authentication?

Login controls are part of ASP. Net’s UI controls collection which allows users to enter their username and password to login to a website/application. They provide login solution without the need of writing code...........
Read answer
What is Fragment Caching in ASP.NET?

Fragment caching does not cache a WebForm, rather it allows for caching of individual user controls within a Web Form, where each control can have different cache duration and behavior...........
Read answer
What is partial classess in .net?

.Net2.0 supports the concept of partial classes which is unlike the concept of one class one file. In .Net technology, one can define a single class over multiple files using the concept of partial classes............
Read answer
Explain how to pass a querystring from an .asp page to aspx page.

Yes you can do it using a hyperlink< BR>Click to go to aspx .............
Read answer
Overview of the .NET Compact Framework

.NET Compact Framework is a scaled down versions of .NET framework for supporting Windows CE based mobile and embedded devices like mobile phones...............
What is Language Integrated Query (LINQ)?

LINQ is a set of extensions to .NET Framework that encapsulate language integrated query, set and other transformation operations...................
Next>>

Also Read

ASP.NET DataList Control

Using the DataList control, Binding images to a DataList control dynamically, Displaying data using the DataList control, Selecting, editing and delete data using this control, Handling the DataList control events..........

ASP.NET Methodologies

ASP.NET attempts to make the web development methodology like the GUI development methodology by allowing developers to build pages made up of controls similar to a GUI. Server controls in ASP.NET function similarly to GUI controls in other environments..........

Problems ASP.NET Solves

Microsoft developed ASP.NET, which greatly simplifies the web development methodology...........

ASP.NET issues & options

The truth is that ASP.NET has several issues that need to be addressed..........
Explain the advantages of ASP.NET

Web application exists in compiled form on the server so the execution speed is faster as compared to the interpreted scripts.........
What Is ASP.NET 2.0 AJAX?

AJAX-style communications between client and server. This communication is over web services. Asynchronous communication. All client-to-server communication in the ASP.NET 2.0 AJAX framework is asynchronous................
The components in the ASP.NET 2.0 AJAX packaging

ASP.NET AJAX Futures Community Technology Preview (CTP) — The ASP.NET 2.0 AJAX framework contains a set of functionality that is experimental in nature. This functionality will eventually become integrated with the RTM/Core code.
Potential benefits of using Ajax

AJAX makes it possible to create better and more responsive websites and web applications...............
Potential problems with AJAX

Search engines may not be able to index all portions of your AJAX application site.........
What Is ASP.NET AJAX?

ASP.NET AJAX is the name of Microsoft’s AJAX solution, and it refers to a set of client and server technologies that focus on improving web development with Visual Studio...............
Balancing Client and Server Programming with ASP.NET AJAX

With AJAX, much of the logic surrounding user interactions can be moved to the client. This presents its own set of challenges. Some examples of AJAX use include streaming large datasets to the browser that are managed entirely in JavaScript..................

Understanding Anonymous Types

Anonymous types defined with var are not VB variants. The var keyword signals the compiler to emit a strong type based on the value of the operator on the right side. Anonymous types can be used to initialize simple types like integers and strings but detract modestly from clarity and add little value..............
Model View Controller

We will learn about MVC design patterns, and how Microsoft has made our lives easier by creating the ASP.NET MVC framework for easier adoption of MVC patterns in our web applications...............
MVC Design

MVC, which stands for Model View Controller, is a design pattern that helps us achieve the decoupling of data access and business logic from the presentation code , and also gives us the opportunity to unit test the GUI effectively and neatly, without worrying about GUI changes at all..........


1.
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

3. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

4. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

5. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

6. Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture

7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

8. What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");

10. What data types do the RangeValidator control support?
Integer, String, and Date.

11. Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the client's browser.

12. What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

13. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
· A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to the original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on demand.
· There's no concept of cursor types in a DataSet.
· DataSets have no current record pointer You can use For Each loops to move through the data.
· You can store many edits in a DataSet, and write them to the original data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

17. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

18. Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

19. Whats an assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20. Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21. Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

22. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

24. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

25. Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.

26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.

27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.

28. What base class do all Web Forms inherit from?
The Page class.

29. Name two properties common in every validation control?
ControlToValidate property and Text property.

30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.

31. Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.

32. How many classes can a single .NET DLL contain?
It can contain many classes.


Web Service Questions

1. What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.

2. True or False: A Web service can only be written in .NET?
False

3. What does WSDL stand for?
Web Services Description Language.

4. Where on the Internet would you look for Web services?
http://www.uddi.org

5. True or False: To test a Web service you must create a Windows application or Web application to consume this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.

Tuesday, May 11, 2010

Code Rescuer: JSLatest

Code Rescuer: JSLatest

JSLatest

http://code.jquery.com/jquery-latest.js

jquery sample

Replace # with < and >


#%@ Page Language="C#" AutoEventWireup="true" CodeFile="password_reminder.aspx.cs" Inherits="password_reminder" %#

#!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 id="Head1" runat="server"#
#meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /#
#title#Operation Homes.com#/title#
#link href="css/pop.css" rel="stylesheet" type="text/css" /#

#script src="js/jslatest.js"##/script#
#script language="javascript" type="text/javascript"#



function clear()
{

document.getElementById("txtemail").innerHTML="";
return false;
}




function btnsubmit_onclick()
{
if (emptyvalidation(document.getElementById('hdn1'),"Woops! You forgot to fill in your Email Address")==false)
{
document.getElementById('hdn1').focus();
return false;
}
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.getElementById('hdn1').value;

if(reg.test(address) == false)
{
alert('Woops! You have entered an invalid Email Address');
document.getElementById('txtemail').focus();
document.getElementById('txtemail').select();
return false;
}



document.getElementById('LoadingImage').style.display="inline";
var ret = SimpleService.Forgotpass(document.getElementById("hdn1").value, OnComplete, OnTimeOut, OnError);

return false;
}

function OnComplete(args) {

if(args.toString()=='1')
{
document.getElementById('LoadingImage').style.display="none";
document.getElementById("Label1").style.display="inline";
document.getElementById("Label1").innerHTML ="Your Password has been sent to your EmailId";
//document.form1.msg.value="sent";

}
else
{
document.getElementById('LoadingImage').style.display="none";
document.getElementById("Label1").style.display="inline";
document.getElementById("Label1").innerHTML ="Invalid EmailId";

}

}

function OnTimeOut(args) {
alert("Service call timed out.");

}

function OnError(args) {
alert("Error calling service method.");
}

#/script#
#/head#

#body#
#form id="form1" runat="server"#
#script#
$("input").change(function () {
document.getElementById('hdn1').value= $(this).val();

}).keyup();



#/script#
#asp:ScriptManager ID="ScriptManager1" runat="server"#
#Services#
#asp:ServiceReference Path="SimpleService.asmx" /#
#/Services#
#/asp:ScriptManager#

#div class="password_reminder"#
#div class="head_pass"##img src="images/pass_logo.jpg" alt="" /##/div#

#div class="content_pass" id="password_content" #
#asp:UpdatePanel ID="UpdatePanel1" runat="server"#
#ContentTemplate#

#table width="100%" border="0" cellspacing="0" cellpadding="0" class="bord"#
#tr#
#td height="28" colspan="3" align="center" bgcolor="#EFEFEF" ##h1#Password Reminder#/h1##/td#
#/tr#
#tr#
#td height="28" colspan="3" align="center" bgcolor="#EFEFEF"##strong#Please enter
the email address you used when you registered #/strong##/td#
#/tr#
#tr#
#td width="33%" height="35" bgcolor="#EFEFEF" #Enter Your Email Address#/td#


#td width="36%" height="28" bgcolor="#EFEFEF" #
#asp:TextBox ID="txtemail" runat="server" ReadOnly="false"
##/asp:TextBox#
#/td#
#td width="31%" bgcolor="#EFEFEF" # user@domain.com#/td#
#/tr#
#tr#
#td bgcolor="#EFEFEF" colspan="2" height="35" width="33%"#
#asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Red"##/asp:Label#

#/td#
#td bgcolor="#EFEFEF" width="31%"#
#asp:HiddenField ID="hdn1" runat="server" /#
#asp:Image ID="LoadingImage" runat="server" Height="24px"
ImageUrl="~/images/bigrotation2.gif" Width="28px" /#
#/td#
#/tr#
#tr#
#td height="35" colspan="3" bgcolor="#EFEFEF" #

#a href="#"#
#asp:ImageButton ID="btnsubmit"
ImageUrl="images/sub_btn.jpg" CssClass="btn" runat="server"
OnClientClick="return btnsubmit_onclick()" /#
#/a# #a href="#"#
#/a##/td#
#/tr#
#/table#
#/ContentTemplate#
#/asp:UpdatePanel#
#/div#
#/div#
#/form#
#/body#
#/html#