Facebook Twitter Gplus RSS
magnify
magnify
formats

Exception or Error Handling and Logging in MVC4

in ASP.NET

Error handing is the main concern in any application, whether it is web application or desktop application. Usually, we catch the exception and log its details to database or text,xml file and also display a user friendly message to end user in-place of error.

Asp.Net MVC has some bulit-in exception filters. HandleError is the default bulit-in exception filter. Let’s see how to use this filter with in your application.

 

Read more…

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Nesting Master Pages with ASP.NET 4.0 and C#

in ASP.NET, C#

To demonstrate nesting master pages we will need to create two master pages, a main master page and a sub master page. Then, we will derive a content page from the sub master page to demonstrate how the pages all link together. At this point I have created a new ASP.NET Empty Web Site.

Read more…

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

ASP.NET Advanced Technologies Tutorial

in ASP.NET

A query string is a value specified in an HTTP query that can be accessed easily within ASP.NET. The query string is appended at the end of the URL following the question mark(‘?’) character. Multiple query strings can be specified in the URL by separating them by either an ampersand(‘&’) or a semicolon(‘;’). The following is an example of the query string with a field name of ‘id’ and a value of ’1′: http://www.mywebsite.com/default.aspx?id=1. Query strings can be used for many different reasons, one common use is to display different data on the same page based on the query string. For example, if I had an online store and wanted a page to display an inidividual item from my database on the page, we could use a query string. This would work by passing something such as the item’s id in the database as a query string to the page, and then displaying data from the database based on the value of the query string.

Read more…

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Announcing the ASP.NET and Web Tools 2012.2 Release Candidate

in ASP.NET

This week the ASP.NET and Visual Web Developer teams delivered the Release Candidate of the ASP.NET and Web Tools 2012.2 update (formerly ASP.NET Fall 2012 Update BUILD Prerelease). This update extends the existing ASP.NET runtime and adds new web tooling to Visual Studio 2012. Whether you use Web Forms, MVC, Web API, or any other ASP.NET technology, there is something cool in this update for you.

 

More at Scott Blog

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Understanding Text Encoding in ASP.NET MVC

in ASP.NET, MVC

This article covers the various ways in which you might handle text encoding in ASP.NET MVC. For example, if you were writing a forum web app, you should absolutely be paranoid about what your users are typing into your site. You need to be very careful about how you redisplay their input.

Complete

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

ASP.NET and Hibernate

in ASP.NET

Hibernate is an object-relational mapping (ORM) solution for the Java language: it provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

Hibernate is free as open source software that is distributed under the GNU Lesser General Public License.

Hibernate’s primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases, with database portability delivered at very little performance overhead.

Hibernate provides transparent persistence for “Plain Old Java Objects“; the only strict requirement for a persistent class is a no-argument constructor, not compulsorily public. (Proper behavior in some applications also requires special attention to the equals() and hashCode() methods.[1])

Hibernate can be used both in standalone Java applications and in Java EE applications using servlets or EJB session beans.

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Real-Time Chart using HTML5 Push Notification (SSE) and ASP.NET Web API

In my recent post, we have seen how to create basic chart using jQuery Flot and ASP.NETWeb API. In this article, we’ll create a chart to display real-time updates using native HTML5 push notification. The HTML5 Server-Sent event (SSE) model allows you to push real-time data updates from the server to the browser.

more at http://techbrij.com / Post

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Control Adapters

The release of ASP.NET 2.0 introduces an alternate way to specify renderings of controls through a technology called control adapters. If you have heard of control adapters at all, it is probably in the context of providing alternate renderings of controls for mobile devices. They actually serve a more general purpose of providing a way of completely changing the rendering of a control based on the browser type of the client, which turns out to be useful in a number of situations.

Mobile device rendering is still the most obvious application of control adapters. For example, for a mobile phone, the control contents should render as WML instead of HTML. Ideally, developers would still use familiar ASP.NET controls, like Calendar and GridView, but when they are accessed by a WML device, a control adapter would kick in and provide an alternate rendering that would work within the constraints of the client device. With an updated collection of control adapters released as new devices come onto the market, developers would only have to update their list of control adapters, and suddenly their Web content would be available to these new devices without changing any of their actual code or page content.
 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Authentication, Cross-App Redirects, and ASP.NET 4.5

in ASP.NET

I started to test out the migration of our web applications with ASP.NET 4.5. In many cases, we have a login page that redirects from one domain to another domain or sub-domain. In those instances, we’re setting the enableCrossAppRedirects property in the configuration files. You can find out more about setting this by visiting MSDN at http://msdn.microsoft.com/en-us/library/eb0zx8fc(v=VS.100).aspx.

After upgrading the web server to ASP.NET 4.5, we noticed this stopped working. The users would hit the other domain and be redirected back to the authentication domain. Some digging around (and help from Barry Dorrans) lead us to two possible solutions:

  1. We need to ensure that all web servers that are running this machines are up to date with their ASP.NET security patches.
  2. If we are forcing one of our applications to use the ASP.NET 4.5 runtime, that same application will need to have the appropriate machineKey CompatibilitySetting checked off. We’ll look at this in greater detail below.

read more at jason gaylord blog

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
formats

Web Forms Extensibility: Control Adapters

All ASP.NET controls from version 2.0 can be associated with a control adapter. A control adapter is a class that inherits from ControlAdapter and it has the chance to interact with the control(s) it is targeting so as to change some of its properties or alter its output. I talked about control adapters before and they really a cool feature.

The ControlAdapter class exposes virtual methods for some well known lifecycle events, OnInit, OnLoad, OnPreRender and OnUnload that closely match their Control counterparts, but are fired before them. Because the control adapter has a reference to its target Control, it can cast it to its concrete class and do something with it before its lifecycle events are actually fired. The adapter is also notified before the control is rendered (BeginRender), after their children are renderes (RenderChildren) and after itself is rendered (Render): this way the adapter can modify the control’s output.

 

Read more…

 
Tags:
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments