Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link


Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main Source:Google.com.All the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose.
Technicalsymposium.com is not liable/responsible for any copyright issues.


ASP.Net Materials Free Download





36) What are Validation Annotations?

Data annotations are attributes which can be found in the “System.ComponentModel.DataAnnotations” namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes?—?Required, String Length, Regular Expression and Range are used to cover the common validation scenarios.

37) Why to use Html.Partial in MVC?

This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods. We can use this like below –

@Html.Partial(“TestPartialView”)

38) What is Html.RenderPartial?

Result of the method?—?“RenderPartial” is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls “Write()” internally and we have to make sure that “RenderPartial” method is enclosed in the bracket. Below is the sample code snippet –@{Html.RenderPartial(“TestPartialView”); }

39) What is RouteConfig.cs in MVC 4?

“RouteConfig.cs” holds the routing configuration for MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax.

40) What are Scaffold templates in MVC?

Scaffolding in ASP.NET MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views.

41) Explain the types of Scaffoldings.

Below are the types of scaffoldings –

Empty

Create

Delete

Details

Edit

List

42) Can a view be shared across multiple controllers? If Yes, How we can do that?

Yes, we can share a view across multiple controllers. We can put the view in the “Shared” folder. When we create a new MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages.

43) What are the components required to create a route in MVC?

Name?—?This is the name of the route.

URL Pattern?—?Placeholders will be given to match the request URL pattern.

Defaults –When loading the application which controller, action to be loaded along with the parameter.

44) Why to use “{resource}.axd/{*pathInfo}” in routing in MVC?

Using this default route?—?{resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like?—?WebResource.axd or ScriptResource.axd from passing to a controller.

45) Can we add constraints to the route? If yes, explain how we can do it?

Yes we can add constraints to route in following ways –

Using Regular Expressions

Using object which implements interface?—?IRouteConstraint.

46) What are the possible Razor view extensions?

Below are the two types of extensions razor view can have –

.cshtml?—?In C# programming language this extension will be used.

.vbhtml?—?In VB programming language this extension will be used.

47) What is PartialView in MVC?

PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it’s been shared with multiple views these are kept in shared folder. Partial Views can be rendered in following ways –

Html.Partial()

Html.RenderPartial()

48) How we can add the CSS in MVC?

Below is the sample code snippet to add css to razor views –

link rel=”StyleSheet” href=”/@Href(~Content/Site.css”)” type=”text/css”/

49) Can I add MVC Testcases in Visual Studio Express?

No. We cannot add the test cases in Visual Studio Express edition it can be added only in Professional and Ultimate versions of Visual Studio.

50) What is the use .Glimpse in MVC?

Glimpse is an open source tool for debugging the routes in MVC. It is the client side debugger. Glimpse has to be turned on by visiting to local url link -

http://localhost:portname//glimpse.axd

This is a popular and useful tool for debugging which tracks the speed details, url details etc.

1. What is ASP.Net?

It is a framework developed by Microsoft on which we can develop new generation web sites using web forms(aspx), MVC, HTML, Javascript, CSS etc. Its successor of Microsoft Active Server Pages(ASP). Currently there is ASP.NET 4.0, which is used to develop web sites. There are various page extensions provided by Microsoft that are being used for web site development. Eg: aspx, asmx, ascx, ashx, cs, vb, html, XML etc.

2. What's the use of Response.Output.Write()?

We can write formatted output using Response.Output.Write().

3. In which event of page cycle is the ViewState available?

After the Init() and before the Page_Load().

4. What is the difference between Server.Transfer and Response.Redirect?

In Server.Transfer page processing transfers from one page to the other 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. The clients url history list or current url Server does not update in case of Server.Transfer. Response.Redirect is used to redirect the user's browser to another page or site. It performs 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.

5. From which base class all Web Forms are inherited?

Page class.

6. What are the different validators in ASP.NET?

1. Required field Validator

2. Range Validator

3. Compare Validator

4. Custom Validator

5. Regular expression Validator

6. Summary Validator

7. Which validator control you use if you need to make sure the values in two different controls matched?

Compare Validator control.

8. What is ViewState?

ViewState is used to retain the state of server-side objects between page post backs

9. Where the viewstate is stored after the page postback?

ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.

10. How

long the items in ViewState exists?

They exist for the life of the current page.

11. What are the different Session state management options available in ASP.NET?

1. In-Process

2. Out-of-Process.

In-Process stores the session in memory on the web server.

Out-of-Process Session state management stores data in an external server. The external server may be either a SQL Server or a State Server. All objects stored in session are required to be serializable for Out-of-Process state management.

12. How you can add an event handler?

Using the Attributes property of server side control.

e.g.

btnSubmit.Attributes.Add("onMouseOver","JavascriptCode();")

13. What is caching?

Caching is a technique used to increase performance by keeping frequently accessed data or files in memory. The request for a cached file/data will be accessed from cache instead of actual location of that file.

14. What are the different types of caching?ASP.NET has 3 kinds of caching :

1. Output Caching,

2. Fragment Caching,

3. Data Caching.

15. Which type if caching will be used if we want to cache the portion of a page instead of whole page?

Fragment Caching: It caches the portion of the page generated by the request. For that, we can create user controls with the below code:

%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%

16. List the events in page life cycle.

1) Page_PreInit

2) Page_Init

3) Page_InitComplete

4) Page_PreLoad

5) Page_Load

6) Page_LoadComplete

7) Page_PreRender

8) Render

17. Can we have a web application running without web.Config file?

Yes

18. Is it possible to create web application with both webforms and mvc?

Yes. We have to include below mvc assembly references in the web forms application to create hybrid application. System.Web.Mvc

System.Web.Razor

System.ComponentModel.DataAnnotations

19. Can we add code files of different languages in App_Code folder?

No. The code files must be in same language to be kept in App_code folder.

20. What is Protected Configuration?

It is a feature used to secure connection string information.

21. Write code to send e-mail from an ASP.NET application?

MailMessage mailMess = new MailMessage ();

mailMess.From = "abc@gmail.com";

mailMess.To = "xyz@gmail.com";

mailMess.Subject = "Test email";

mailMess.Body = "Hi This is a test mail.";

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send (mailMess);

MailMessage and SmtpMail are classes defined System.Web.Mail namespace.

22. How can we prevent browser from caching an ASPX page?

We can SetNoStore on HttpCachePolicy object exposed by the Response object's Cache property:

Response.Cache.SetNoStore ();

Response.Write (DateTime.Now.ToLongTimeString ());

23. What is the good practice to implement validations in aspx page?Client-side validation is the best way to validate data of a web page. It reduces the network traffic and saves server resources.

24. What are the event handlers that we can have in Global.asax file?

Application Events: Application_Start , Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache

Session Events: Session_Start,Session_End

25. Which protocol is used to call a Web service?

HTTP Protocol

26. Can we have multiple web config files for an asp.net application?

Yes.

27. What is the difference between web config and machine config?

Web config file is specific to a web application where as machine config is specific to a machine or server. There can be multiple web config files into an application where as we can have only one machine config file on a server.

Source: Contents are provided by Technicalsymposium Google Group Members. Disclaimer: All the above contents are provided by technicalsymposium.com Google Group members. Further, this content is not intended to be used for commercial purpose. Technicalsymposium.com is not liable/responsible for any copyright issues.