'.NET' Category Results

Test Questions for 70-519 – Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4

Wednesday, January 26th, 2011

So last week I passed the Microsoft test 70-519 and thought I would share a sample of the test questions with you. It’s quite daunting the range of skills the test pulls from. I have been a software developer for over twelve years and this test seems to have found a way to span almost my entire arsenal of skills. Or at least my Microsoft skills. Here are some of the skills measured:

– ASP.NET (both Web Forms and MVC)
– C#
– Ajax
– jQuery
– Windows Communications Foundation (WCF)
– ADO.NET
– ASP.NET Web Services
– LINQ and Entity Framework
– IIS
– Unit Testing, debugging and deployment
– Application state, session state, and request state (for example, ViewState, ControlState, Cache object, cookies, and client-side persistence)
– Globalization – designing to support local, regional, language, or cultural preferences

There’s probably more that I’m forgetting. Bottom line is wow, it’s a good thing that I have played with [most] of this stuff at one time or another because you aren’t just going to get lucky when it comes to passing this test.

Some questions include:

You need to recommend appropriate technologies for designing Web forms for entry and retrieval of news items.
Which technologies should you recommend? (Each correct answer presents a complete solution. Choose two.)

A. ASMX and SOAP
B. WCF Data Services and jQuery
C. ASP.NET MVC 2 and Microsoft AJAX
D. Entity Framework and Microsoft Silverlight

Answer: B and C

You are designing an ASP.NET MVC 2 Web application. You have the following requirements:
“Type safety must be validated at compile time.”
“Code must not require explicit run-time type casting.”
You need to pass data between the controllers and the views within the Web application. Which approach should you recommend?

A. Use the View Data Dictionary class
B. Use the Temp Data Dictionary class
C. Use strongly typed view model classes
D. Use dynamic object view model classes

Answer: C

You are designing a deployment process for a new ASP.NET Web application.
The company requires the application to be compiled to a single DLL for deployment.
You need to design a deployment process that meets the requirement.
Which approach should you recommend?

A. Use MSDeploy
B. Use the Web Deployment tool
C. Use a Web Deployment project
D. Use the ASP.NET Compilation tool

Answer: C

You are designing an ASP.NET MVC 2 application.
You need to centralize the logic for handling and logging unhandled exceptions.
Which approach should you recommend?

A. Use try and catch on every method
B. Override the One Exception method of each controller
C. Decorate all controllers with a custom Handle Error attribute
D. Decorate all controllers with the default Handle Error attribute

Answer: C

You need to design a solution for incorporating NTFS permissions in the Web application.
Which two approaches should you recommend? (Each correct answer presents part of the solution. Choose two.)

A. Grant the Network Service account only Read permission to the root directory
B. Grant Read permission and Write permission to the root directory
C. Grant the Network Service account Full Control permission to the Upload folder
D. Grant the Network Service account Read permission and Write permission to the Upload folder

Answer: A and D

You need to design a solution for capturing an exception. Which approach should you recommend?

A. Use a Page_Error method
B. Use a HandleError attribute
C. Use a CustomErrors element
D. Use an Application_Error method

Answer: B

Good luck to all, you’re gonna need it…

ASP.NET, LINQ, jQuery, JSON, Ajax – Oh my!

Monday, April 26th, 2010

In this article we will be looking at a different type of architecture. One in which we utilize jQuery’s ability to easily transfer data (via Ajax and JSON) from the client to the server. We then use ASP.NET and LINQ to SQL to query the database and return a collection of data which gets (automatically) serialized to JSON and sent to the client. The benefits of combining these technologies include: more responsive applications, more processing on the client, less processing on the server and reduced network traffic. Everything runs faster and uses fewer resources.

Still not convinced? Here are some additional benefits of this architecture:

Benefits of the Architecture

  1. Unlike an ASP.NET UpdatePanel we only pass what we need; we only receive what we need. We don’t pass ViewStates, in fact we don’t even have a ViewState. We also don’t pass entire HTML chunks and receive HTML chunks we don’t use. For more on this; read: Why ASP.NET AJAX UpdatePanels are dangerous.
  2. By using jQuery to call the web service directly, we’ve eliminated over 100 KB of JavaScript and three extra HTTP requests that’s included when you use ASP.NET Ajax.
  3. Less dependencies – because all our code is simply xHTML we could switch to a PHP or a Java backend and none of our code for the UI would have to change. That’s right, there are no server-controls; that means no GridViews, no Repeaters, no ListViews, nothing that uses runat server will be found on the page. Not even a ScriptManager.
  4. Usability – We can create RIA interfaces AND maintain usability, giving us the best of both worlds.
  5. Cross-Browser friendly – We use nothing but xHTML code and jQuery which works across browsers.
  6. The entire presentation for the UI is done via CSS. Change the CSS and the entire UI can look different.
  7. We maintain a ‘Separation of Concerns‘ – this means we have 3 distinct and wholly separate code bases. A content or HTML level. A presentation or CSS level and a behavior or JavaScript level. We don’t have code mixed together in a web-page jambalaya.
  8. Switching architectures from Web Forms to MVC is a breeze.

Hopefully you are salivating at these benefits enough to decide to get your feet wet and follow along.

In this article will be leveraging these technologies to build a grid (or what looks like a table). Later on, in future articles, I will then show you how to implement sorting, paging and filtering on the grid. I have divided this article up into four sections: 1. Sever-side code (ASP.NET). 2. HTML 3. jQuery and lastly CSS.

(more…)

Using jQuery with ASP.NET Controls

Thursday, August 6th, 2009

jQuery, a lightweight (only 19kb in size) JavaScript library has become my new best friend. It’s like mushrooms to Mario. Obviously I’m not alone since Microsoft is now distributing jQuery with Visual Studio (including jQuery intellisense). If you are using the new MVC framework from Microsoft then you will no doubt become familiar with the intricate workings of jQuery.

jQuery is not all that difficult to learn. The biggest thing you have to understand is all the different “selectors” that are available to you. Using selectors developers can query, in a CSS like way, for HTML elements, and then apply “commands” to them.

For example, the below JavaScript uses jQuery to find a <div> element within a page that has a CSS id of “rightSide”, and shows it and “leftSide” and hides it.

javascript

  1. $('div#rightSide').show();
  2. $('div#leftSide').hide();

As another example, the JavaScript below uses jQuery to find a specific <table> on the page with an id of “datagrid1”, then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of “even” – which could be used to alternate the background color of each row:

javascript

  1. $('#datagrid1 tr:nth-child(even)').addClass('even');

This next example gets all links <a> in a specific <div> and attaches an onclick event to them:

javascript

  1. $('#navBtns a').bind('click', function(event){
  2.      event.preventDefault(); //stop the link from going to href
  3.      //do something
  4. });

Being able to traverse the DOM and locate HTML elements to attach events, behaviors, animations and CSS is priceless. But what about ASP.NET controls like the RadioButtonList, GridView, ListView, Repeater, and many others that we as developers like to bind to? How do we traverse them when they all get their ids auto-generated? That’s what we will look at now! And with jQuery it’s not that hard!

(more…)

ASP.NET – Sending Email Both in HTML and Plain Text

Thursday, February 5th, 2009

In this article you will learn how to send email using ASP.NET. Yes, there are plenty of other articles that cover sending email via .NET, but after spending a day doing research, I was amazed at how many articles failed to provide either a correct solution or a real world example. I found that many articles suggest you create your HTML email by using a string with the HTML markup in it. That’s crazy and not at all a real world solution, at least not for most situations. In this article we will look at a more realistic solution. One in which we use a regular HTML file as our template for the email. The template file will be a standard HTML file with the exception of some placeholders that we will use to populate our content and images right before we send the email. Think mail-merge in Microsoft Word. Finally, we will also learn how to send the email in such a way that if the email recipient’s mail-client can’t render HTML they will get an alternate plain text version.

Let’s start by looking at the code in its entirety; the people that just want to grab the code and use it can do so. I will then explain the code.

(more…)

IDing the Problem of ASP.NET

Wednesday, August 20th, 2008

I love ASP.NET, but one thing I find extremely frustrating is dealing with the automatically generated ID properties that it places on page elements.

For example, let’s say you have a div with an id of “contentTop” like below:

  1. <div id="contentTop" runat="server" >...</div>

Because you have made the control a server-side control by adding the runat=”server” attribute it will now be rendered with a different ID when it hits the browser (view the source code and you will see). It will get rendered as something like this:

  1. <div id="ctl00_contentTop" >...</div>

This is because ASP.NET generates its own IDs to ensure that every element on the page has a unique ID. Developers that work with JavaScript and CSS will immediately see the problem. This causes difficulty when using JavaScript and CSS which rely on those IDs to reference elements, as they can’t easily predict what the generated ID will be. When it comes to CSS specificity the ID selector is extremely useful. In addition, anyone that uses JavaScript knows that getElementById (or one of the JavaScript library ways) is the most popular way to target an element. So why the hell does ASP.NET do this to us? Honestly, I can’t really tell why, other than the fact that they must not trust us enough to be able to uniquely ID our elements ourselves.

But I don’t want to just complain here, I would like to provide some solutions too.

Solution

The solution will be found in the ClientID property of the server-side control. The ClientID property represents the ID that ASP.NET will use for the element on the client.

Using the ScriptManager we place the ClientID in a hidden form field. This can all be done in the code-behind file by using the following code:

  1. ScriptManager.RegisterHiddenField(this, "contentTop", contentTop.ClientID);

Be sure to have included the ScriptManager to your page, like so:

  1. <asp:ScriptManager ID="ScriptManager1" runat="server">
  2.     </asp:ScriptManager>

Now we can use JavaScript to retrieve the value from our hidden form fields.

javascript

  1. var id = form1.contentTop.value;
  2. var cTop = document.getElementById('id');

That’s it, if you know of another way, please let us know.
Happy coding.

3 C# 3.0 Shortcuts

Monday, June 16th, 2008

1. Automatic Properties

Automatic properties provide you with a shorthand for defining a new property. No more do we have to create the private property and then use Getters and Setters to access and set that property. Here’s the old code:
[ASP]
private string _Name;

public string Name
{
get {return _Name;}
set {_Name = value;}
}
[/ASP]

Now here’s the code using automatic properties:
[ASP]
public string Name {get; set;}
[/ASP]

Oh my! How nice is that? The C# compiler creates the Getters and Setters and the private fields for you automagically!

(more…)

Objects – Why You Should Care About Them

Wednesday, July 11th, 2007

This past week, I have been undergoing a week of rigorous training learning the key differences between .NET 2.0/3.0 and .NET 1.1. For the past two years our company has been working with the 1.1 framework, and is now migrating towards the 2.0/3.0 framework. This week the instructor said something I knew, but was glad to be reminded about. It wasn’t even a .NET oriented question, it was an object oriented question that does not apply to one specific language, but to all OOP (object oriented programming) models in general.

What is the difference between a struct and a class? When should you use a struct versus a class? How do you know?

(more…)

mulberry sale spyder womens jacket cheap new balance 574 mulberry outlet cheap new balance 574 arcteryx outlet mulberry sale spyder womens jacket mulberry sale spyder womens jacket mulberry outlet mulberry outlet new balance 574

Popular Articles

Top 10 Commentators


Subscribe to this feed! Subscribe by Email!

Random Bits Podcast

Blogs Worth Reading