Archive

Archive for the ‘.net 1.1’ Category

UFrame: goodness of UpdatePanel and IFRAME combined

29 May 2008 Steve Leave a comment

UFrame combines the goodness of UpdatePanel and IFRAME in a cross browser and cross platform solution. It allows a DIV to behave like an IFRAME loading content from any page either static or dynamic. It can load pages having both inline and external Javascript and CSS, just like an IFRAME. But unlike IFRAME, it loads the content within the main document and you can put any number of UFrame on your page without slowing down the browser. It supports ASP.NET postback nicely and you can have DataGrid or any other complex ASP.NET control within a UFrame. UFrame works perfectly with ASP.NET MVC making it an replacement for UpdatePanel. Best of all, UFrame is implemented 100% in Javascript making it a cross platform solution. As a result, you can use UFrame on ASP.NET, PHP, JSP or any other platform.

<div class=”UFrame” id=”UFrame1″ src=”SomePage.aspx?ID=UFrame1″ >
<p>This should get replaced with content from Somepage.aspx</p>
</div>

Introduction to 3-Tier Architecture

30 April 2008 Steve 1 comment

Introduction

As a developer, the .NET framework and Visual Studio present many choices for choosing the right architecture, from placing the data access code directly in the UI through datasets and data source controls, to creating a data access layer that talks to the database, all the way to creating an n-tier architecture approach that consists of multiple layers, and use data-transfer objects to pass data back and forth.

If you’ve ever wondered why you should use layers and what the benefits are, this article is for you. This article delves into the use of layers and how they can benefit any application.

What is a Layer?

A layer is a reusable portion of code that performs a specific function. In the .NET environment, a layer is usually setup as a project that represents this specific function. This specific layer is in charge of working with other layers to perform some specific goal. In an application where the presentation layer needs to extract information from a backend database, the presentation would utilize a series of layers to retrieve the data, rather than having the database calls embedded directly within itself. Let’s briefly look at the latter situation first.

Two-Tier Architecture

When the .NET 2.0 framework became available to the world, there were some neat features that allowed the developer to connect the framework’s GUI controls directly to the database. This approach is very handy when rapidly developing applications. However, it’s not always favorable to embed all of the business logic and data access code directly in the web site, for several reasons:

  • Putting all of the code in the web site (business logic and data access) can make the application harder to maintain and understand.
  • Reusing database queries in the presentation layer often isn’t done, because of the typical data source control setup in the ASP.NET framework.
  • Relying on the data source controls can make debugging more difficult, often due to vague error messages.

So in looking for an alternative, we can separate the data access code and business logic into separate “layers”, which we’ll discuss next.

The Data Layer

The key component to most applications is the data. The data has to be served to the presentation layer somehow. The data layer is a separate component (often setup as a separate single or group of projects in a .NET solution), whose sole purpose is to serve up the data from the database and return it to the caller. Through this approach, data can be logically reused, meaning that a portion of an application reusing the same query can make a call to one data layer method, instead of embedding the query multiple times. This is generally more maintainable.

But the question is how is the data returned? Multiple frameworks employ different techniques, and below is a summary:

  • ADO.NET – Built into the .NET framework, ADO.NET contains a mechanism to query data out of the database and return it to the caller in a connected or disconnected fashion. This is the most common approach to working with data, because it’s already readily available. See more at: http://en.wikipedia.org/wiki/ADO.NET.
  • Table Adapters/Strongly-Typed Datasets – Strongly-typed datasets and table adapters provide a similar means to querying the data through ADO.NET, but add strong-typing features, meaning custom objects are generated for you to work with. See more here.
  • Enterprise Library – Enterprise library Data Access Application Block provides a flexible way to connect to databases of multiple types, without having to know anything about that database, through an abstract approach. See more at: http://msdn2.microsoft.com/en-us/magazine/cc188705.aspx (read part one first).
  • LINQ-to-SQL – LINQ to SQL is an ORM tool that uses a DataContext object as the central point to query data from the database. See more here. (read parts one through eight first).
  • Auto-Generated Code – Tools like CodeSmith Studio automatically generate the code for you based upon a database schema. Simply writing a script to output the code you want to use and the backend is generated in a short amount of time. See more at: http://community.codesmithtools.c om/blogs/tutorials/archive/2006/02/13/nettiers.aspx.

Most (if not all) options above take advantage of the CRUD (create, read, update, or delete) operations that databases support, so all of that is available as shown above. There are plenty of resources online to help you get started. To see an overview of some of the options, please read this.

Business Layer

Though a web site could talk to the data access layer directly, it usually goes through another layer called the business layer. The business layer is vital in that it validates the input conditions before calling a method from the data layer. This ensures the data input is correct before proceeding, and can often ensure that the outputs are correct as well. This validation of input is called business rules, meaning the rules that the business layer uses to make “judgments” about the data.

However, business rules don’t only apply to data validation; these rules apply to any calculations or any other action that takes place in the business layer. Normally, it’s best to put as much logic as possible in the business layer, which makes this logic reusable across applications.

One of the best reasons for reusing logic is that applications that start off small usually grow in functionality. For instance, a company begins to develop a web site, and as they realize their business needs, they later decide to add a smart client application and windows service to supplement the web site. The business layer helps move logic to a central layer for “maximum reusability.”

Presentation Layer

The ASP.NET web site or windows forms application (the UI for the project) is called the presentation layer. The presentation layer is the most important layer simply because it’s the one that everyone sees and uses. Even with a well structured business and data layer, if the presentation layer is designed poorly, this gives the users a poor view of the system.

It’s best to remove as much business logic out of the UI and into the business layer. This usually involves more code, but in my mind, the excess time (which ranges from minimal to moderate, depending on the size of the application) pays off in the end.

However, a well-architected system leaves another question: how do you display it in an ASP.NET or windows application? This can be more of a problem in ASP.NET, as the controls are more limited to the type of inputs they can receive. If you use certain architectures, like passing datasets from the data to the presentation layer, this isn’t as much of a challenge; however, the challenge can come with business objects that support drill-through business object references.

Why Separating Logic Is Useful

You may wonder why it is important to move as much logic outside the presentation layer and into the business layer. The biggest reason is reuse: logic placed in a business layer increases the reusability of an application. As applications grow, applications often grow into other realms. Applications may start out as a web application, but some of the functionality may later be moved to a smart client application. Portions of an application may be split between a web site and a web or windows service that runs on a server. In addition, keeping logic helps aid in developing a good design (sometimes code can get sloppier in the UI).

However, there are some caveats to this: it takes a little longer to develop applications when most of the logic resides in the business layer. The reason is this often involves creating several sets of objects (data layer and access code, plus business objects) rather than embedding it in the application. The extra time that it takes to do this can be a turnoff for some managers and project leads, especially because it often requires you to be knowledgeable about object-oriented programming, more than most people are comfortable with.

Although embedding code in the UI is easier, in most cases I don’t believe it’s the best approach. A layered approach is often a better approach because it pays dividends down the road. This is because as more and more code is developed, the following happens:

  • Code is copied and pasted frequently, or code is reused in classes that could easily be moved to a business layer.
  • Code that is very similar is often copied and pasted with slight modification, making duplication harder to track down.
  • It’s harder to maintain; even though applications with business objects are larger applications, they usually are structured better.
  • Code is harder to unit test, if unit testing is available at all. Web applications and windows forms projects are hard to use unit testing with.

A good architecture is often harder to implement, but is easier to maintain because it often reduces the volume of code. This means that hours spent supporting an application are reduced.

Distributed Applications

Using a separation of layers can aid in development of distributed applications. Because the code is broken up into layers, a layer that facilitates the use of remoting or web services can be added to the project, with a minimal amount of work.

Development Techniques

When developing a business object architecture, it’s good to know about the many design patterns that are out there. There are many websites, blogs, and books related to the subject of design patterns. One of the more well-known books on the subject is titled “Design Patterns,” whom the authors are often referred to as the Gang of Four.

Another useful development technique is called Refactoring, or improving the quality of your code by making small changes to the way it works. This involves moving code into a method, or moving a method from one object to another, in a systematic, logical way. Martin Fowler has written a great book on this subject, called “Refactoring, Improving the Design of Existing Code.” There are plenty of books on the subject; this one is the source that helped me to understand refactoring the most.

There are also tools on the market that can help you refactor in a faster way. One of those tools is Resharper by Jet Brains, which looks for a lot of code patterns and refactors them in a way that is useful. Some of the other refactoring tools that I heard about are Refactor Pro by DevExpress (free for VB.NET and ASP.NET), Visual Assist X by Whole Tomato Software, and Just Code by OmniCore.

Difference between ASP.NET Server Controls and HTML Server Controls

25 January 2008 Steve Leave a comment

Advantages:

1. ASP .NET Server Controls can detect the target browser’s capabilities and render themselves accordingly. No issues for compatibility issues of Browsers i.e page that might be used by both HTML 3.2 and HTML 4.0 browsers code is written in the Server Controls.

2. Newer set of controls that can be used in the same manner as any HTML control like Calender controls. Without any need of Activex Control without bringing up issues of Browser compatibility).

3. Processing would be done at the server side. In built functionality to check for few values(with Validation controls) so no need to choose between scripting language which would be incompatible with few browsers.

4. ASP .NET Server Controls have an object model different from the traditional HTML and even provide a set of properties and methods that can change the outlook and behavior of the controls.

5. ASP .NET Server Controls have higher level of abstraction. An output of an ASP .NET server control can be the result of many HTML tags that combine together to produce that control and its events. Example Gridview or Form control.

Disadvantages:

1. The control of the code is inbuilt with the web server controls so you have no much of direct control on these controls

HTML Server Controls

Advantages:

1. The HTML Server Controls follow the HTML-centric object model. Model similar to HTML

2. Here the controls can be made to interact with Client side scripting. Processing would be done at client as well as server depending on your code.

5. A HTML Server Control has similar abstraction with its corresponding HTML tag and offers no abstraction.

Disadvantages:

1. You would need to code for the browser compatibility.

2. The HTML Server Controls have no mechanism of identifying the capabilities of the client browser accessing the current page.

about value and reference type

3 January 2008 Steve 1 comment

In value type based variables holds memory on stack and hold fixed space for example integer in dot net hold 4 bytes.

In reference type based variables holds memory at managed heap. Reference type variables hold dynamic space. The space hold by reference type can be vary.

When reference is to assign to variable. Only reference is stored in variable. Where this reference is refer actual memory is stored in heap where actual value or data is placed.

Stack is small area of memory where fixed no of space is reserved . for example integer , double always contain same area of memory. So they placed in stack.

While heap is dynamic memory where variable for example string can hold 2 bytes or it contain all available of physical memory

The Fastest Way To Compare Two Strings Equality

26 December 2007 Steve 1 comment

We usually use “==” for string comparing operations. But What if the code will work 10 million times. You must use the best comparing way for minimum time consuming.

We often works with strings when writing codes. Sometimes the case requires to control if two strings are equal or not. And then we usually use the “==” operator to control equality.
If (s1 == s2)
But What if the code will work 10 million times. You must use the best comparing way for minimum time consuming. Run the code below and see which one the best.
The “==” operator is the slowest, and the “s1.Equals(s2)” is the fastest. 
Stopwatch sw = new Stopwatch();
string 
s1 “Some text for testing”;
string 
s2 “Some text for testing.”;
sw.Start();
for 
(int 0(i <10000000)i++) {
    
if (s1 == s2) {
        
//  Do something
    
}
}
sw.Stop()
;
Console.WriteLine(“s1=s2 : ” + sw.Elapsed.TotalMilliseconds.ToString());

sw.Reset();
sw.Start();
for 
(int 0(i <10000000)i++) {
    
if (String.Equals(s1, s2)) {
        
//  Do something
    
}
}
sw.Stop()
;
Console.WriteLine(String.Equals(s1, s2) : ” + sw.Elapsed.TotalMilliseconds.ToString());
sw.Reset();

sw.Start();
for 
(int 0(i <10000000)i++) {
    
if (s1.Equals(s2)){
        
//  Do something
    
}
}
sw.Stop()
;
Console.WriteLine(s1.Equals(s2) : ” + sw.Elapsed.TotalMilliseconds.ToString());

The StringBuilder Object Memory Usage – Capacity

26 December 2007 Steve 1 comment

The StringBuilder class provides good performance for string operations with default attributes. And you can accomplish your string operations with in best memory performance adjusting StringBuilder Capcity property.

When you instantiate a new StringBuilder object, it’s capacity becomes 16 characters.

StringBuilder() sb= new StringBuilder();

And when you add some characters more then 16, it’s capacity raises 16, automatically. (32, 48 etc.)

If you are using some text with low amount of characters, you can instantiate a StringBuilder object with a capacity parameter.

StringBuilder() sb= new StringBuilder(6);

So the capacity of the object will become 6, 12, 18 etc. And the memory usage of the object becomes optimum for the case.

Deploying ASP.NET Applications

21 November 2007 Steve 2 comments

As an ASP.NET developer, we are always focusing on learning new ideas on design and development which made us to have less knowledge on deployment of applications in production. This article targets developer community to have some of the rudimentary knowledge on deployment of ASP.NET application on IIS 6.0. After reading this article a user will be familiar in:

·         Virtual Directories and Creating it

·         Application Pools, Creating Application Pools and why it is used

·         Use of service accounts in Application Pools

·         Web.Config Settings and using Web.Config Settings for debugging errors

·         Common hindrance we may possibly face during deployment and resolutions

It is assumed that the user is logged in to the server or connected to the server through Remote Desktop Connection and the user has enough permission to do the deployment.

Preparing the application for deployment

[ Back To Top ]

We can use the Web Deployment plug-in for Visual studio 2005 given by Microsoft for creating Web deployment projects for 2.0 Applications, where we can compile in release mode for 1.1 applications for deployment. See the reference section for more details on Web Deployment plug-in. Copy the application to a folder location where the application needs to be deployed on the server. Make all Web.Config changes, like updating connection strings, if there is any appsettings values changes corresponding to production environments, etc.

Virtual Directory

An IIS Virtual Directory is essentially an alias to the physical directory. The IIS Virtual Directory is a directory name which may be accessed from the Internet to access the physical directory on the server.

The most common ways of creating virtual directory is done through two methods.

1.    Using IIS Manager

2.    Using Windows Explorer

Using IIS Manager

We can open IIS manager in 3 ways:

·         Type Inetmgr in RUN

·         Open Control Panel > Administrative tools > Internet Information Services

·         Right click My Computer, click Manage and expand Internet Information Services

Creation

Doing any of the above approach will bring us the IIS manager.

1.    Expand the local computer node, right click the Website under which you want to deploy the application and click New > Virtual Directory. It will bring a dialog like Figure 1.

Figure 1 – Create Virtual Directory

                                                     

 Click Next.

2.    It will bring the next window for entering “Alias” for our websites. See Figure 2.

Figure 2 – Virtual Directory Alias

 

Type the alias name you would like to assign for the applications virtual directory. I have used “test” for this article. Click Next.

3.    It will bring a window for linking our website’s physical directory with virtual directory.

Figure 3 – Physical Directory Path

Browse to the location and select the website folder. Click Next.

4.    This will bring the window for specifying access permissions for the users. Select appropriate permissions.

Figure 4 – Virtual Directory Access Permission

  

I have not changed the default setting in this window as this permission is more than enough to run most of the applications. Click Next.      

5.    Click Finish. Thus we have created the virtual directory. 

Using Windows Explorer               

1.    Browse to the folder location where you copied the application and right click the folder and click “Sharing and security.”

2.    Open “Web Sharing” tab and select “Share this folder” which will ask for the Alias. Type an Alias name, click OK and click OK again. We have created virtual directory through windows explorer.

Configure ASP.NET version

Sometimes the server we are deploying may have both 1.1 and 2.0 framework installed. So we need to configure the applications to use appropriate framework. It can be done through the ASP.NET tab of virtual directory property box like in Figure 5.

Figure 5 – ASP.NET version picker

If it is 2.0 Application, select 2.0.xxxxx version or else 1.1.xxxx.

Application Pools

[ Back To Top ]

Application Pools or App Pools are introduced with IIS 6.0 to isolate websites into a group called Application Pools. Also we can say application pools are a group of one or more URL’s that are served by a worker process, meaning applications running in a single app pools run in the same worker process w3wp.exe, thus providing a boundary so that if one application fails it does not hinder other applications running on other app pools. So as a good practice a highly confidential, secured website can be assigned with a separate app pool. Also we can use app pools to troubleshoot applications by isolating them to a separate application pool if we suspect that it creates problem. By using an application pool, we can have specific configuration settings to a worker process that services a group of applications or single application that is running under the App Pool. For example, you can configure worker process recycling and several other configuration options to match the needs of each application. We will see this in detail in coming sections.

With this introduction to Application pools we will move to our subject matter, creating Application pools in IIS 6.0.

Creation

A new application pool can be created using IIS Manager.

Steps

1.    Open IIS Manager.

2.    Expand local computer node. Right click Application Pools node and click New> Application Pool like Figure 6.

Figure 6 – Creating New Application Pool

                   

 It will open a dialog to create new app pool.

Figure 7 – Application Pool ID                          

 

Type a Pool ID for the app pool, the best practice to give identity is choosing a name relevant to the applications hosted. For example, if the app pool hosts a Shopping cart site, let the pool identity be ShoppingCartPool so that it can be easily identified as opposed to AppPool #1, 2, etc. Under Application pool settings> select “Use default settings for new application pool,” Selecting “Use existing application pool as template” will prompt as to select an existing app pool as the template so that same setting is applied for the newly created app pool.

3.    Click OK. A new application pool is created with default configurations.

Customizing Application pools

By default, Application pools are configured to use Network Service Account to service the request. At times we will end in a situation where we should use a separate account for servicing the request for different reasons. There are other configuration settings which some times need to be optimized, which are really done in exceptional situations. The coming sections will answer these things and take us through accomplishing this.

Steps

1.    Right click the Application pool you have created (Test Pool) in this example and click Properties. It will bring up a dialog like the one below.

Figure 8 – Application Pool Property recycling tab

                                          

Recycling tab is opened with default settings. Periodic recycling of your application pools is recommended to help to clean up memory fragmentation, memory leaks, abandoned threads and other disorders. Keep in mind that when an application pool recycles, session state information stored in-process is lost for that pool, but other pools are not affected. ASP.NET, however, does allow you to store your session state outside the worker process, so that session information is not lost during a recycle. We can recycle the worker process based on the number of requests and memory usages.

2.    Moving to Performance tab. Refer to Figure 9.

Figure 9 – Application Pool Property Performance tab

              

When the application does not receive a request for certain amount of time, it is said to be idle so this setting allow us to free up the occupied resource from the server after the specified time given here. Consider changing the Request queue limit if your application receives thousands request per second to mitigate Server busy messages. Most of the time Enable CPU monitoring is not used. Web garden setting should not be changed from 1, this specifies the number of worker process required to process the request for an app pool.

3.    Next, tab “Health” tab for configuring the health, i.e. the availability of the application can be configured. Refer to Figure 10.

Figure 10 – Application Pool Property Health tab

 

    

Enable pinging causes IIS to automatically query a worker process to see if it is responsive and utilizing network bandwidth. Enable rapid-fail protection helps to disable the app pool for specified number of failures occurred in the worker process. Startup time limit and shutdown time limit are self explanatory and failing to satisfy those condition falls under failure for rapid fail protection.

4.    The “Identity” tab is where we can configure the worker process identity.

Figure 11 – Application Pool Property Identity tab

 

The predefined setting’s default is to use network service account which is a less privileged account for security purposes. The other account that can be preconfigured is Local Service and LocalSystem account. Before making the App pool to use custom account known as Service accounts, we will explore what and why it is used.

Service Accounts

It is the identity of the App pool under which it services the request. It is the account that has very less privileges on the machine so as to reduce the security risk and loop holes. There can be several reasons to opt for custom service account over the Network service account. Some of the reasons are:

·         We can have different access controls for different applications on the local and network resources such as fileservers, etc.

·         It is also a mode of isolating one application from another by giving a separate identity so other applications cannot access the resource of another application.

·         We can prevent any accidental or deliberate changes to the access controls or permissions associated with the general purpose Network Service account from affecting your application.

See reference section for creating new service accounts.

One think to note here is if our site uses a database then make sure that the custom service account has the required access to the database.

Configuring Custom service account with Application Pool

In the above Figure select Configurable> type the service account id, password and enter. It will ask for password confirmation like the figure below. Click OK.

Figure 12 – Configure service account

After doing this restart the App pool by stopping and starting it again.

Associating Site with Application Pool

We need to associate our site with the App pool we created. It can be done by right clicking the site’s virtual directory (Test in our case) and property. Select the TestPool from Application pool drop down in “Home Directory” tab as in Figure 13. Click Apply and OK.

Figure 13 – Associating site with Application Pool

 

We are at the end of the process and we need to do a smoke test for the application verification.

Possible Errors

[ Back To Top ]

Error

Service unavailable

Resolution

This is one of the ever green errors we often used to get mostly because of service accounts. The common problem will be this account might not be a member of IIS_WPG group on the server or check IIS_WPG group have Read & Execute, List Folder Contents, and Read permissions to the Web site directories. So precheck with a network admin who is creating the service account for you whether the account has all the required permissions on the server.

Error

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (Provider: TCP Provider, error: 0 – A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

Resolution

Again, there may be several reasons, the most common is checking if the service account has access to the SQL Server. This error occurs even if you are not using SQL Server 2005, i.e. the same error occurs even if you use SQL Server 2000. Similar error occurs if there is any problem in the connection string too.

Error

It is not possible to run different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.

Resolution

When we host multiple versions of ASP.net in a single server, we may get this error in event log. The problem might be an application pool will be associated with 2 different applications that use different frameworks. So isolating this application into a different App Pools will solve the problem.

Points to note

[ Back To Top ]

This section highlights some of the important things to consider when we are deploying the application.

1.    Make sure the Web.Config setting is perfect, such as connection strings, App setting values, check <compilation debug=”false”/> because setting it to true causes the application to be processed slow, memory consumption is more, scripts and images downloaded from the WebResources.axd handler are not cached.

2.    To trouble shoot the error if it occurred use <CustomErrors> section in Web.Config and make sure you are reverting back to the original settings.

3.    If we are running multiple versions of ASP.net on the same webserver do not use aspnet_regiis utility with –i switch to register the ASP.net with the IIS, instead use –s switch and register it for the particular site because using –i switch is going to update the entire IIS with the current version of ASP.net you are registering leaving the existing application configuration affected. For example, Aspnet_regiis –s W3SVC/1/ROOT/Test.

4.    By default, IIS does not allow dynamic contents like ASP\ASP.NET to be processed by IIS. So to allow this, Open IIS manager, click Web Service Extensions and Allow the Web Service Extensions if it is disabled as shown in Figure 14. If there is no extensions for processing ASP.net 2.0 application, we can add a new web service extension by clicking “Add a new Web service extension” link. Read more on MSDN on how to add web service extensions in IIS 6.0.

Figure 14 – Web service Extensions

References

[ Back To Top ]

Visual Studio 2005 Web Deployment Projects

How To: Create a Service Account for an ASP.NET 2.0 Application

Microsoft Support center

Software Architecture: a Roadmap

17 November 2007 Steve Leave a comment

Over the past  software architecture has received increasing attention as an important subfield of software engineering. During that time there has been considerable progress in developing the technological and methodological base for treating architectural design as an engineering discipline. However, much remains to be done to achieve that goal. Moreover, the changing face of technology raises
a number of new challenges for software architecture. This article examines some of the important trends of software architecture in research and practice, and speculates on the important emerging trends, challenges, and aspirations.

THE ROLES OF SOFTWARE ARCHITECTURE

While there are numerous definitions of software architecture, at the core of all of them is the notion that the architecture of a system describes its gross structure. This structure illuminates the top level design decisions, includeing things such as how the system is composed of interacting parts, where are the main pathways of interaction, and what are the key properties of the parts. Additionally, an architectural description includes sufficient information to allow high-level analysis and critical appraisal. 

To elaborate, software architecture can play an important role in at least six aspects of software development.

1. Understanding: Software architecture simplifies our ability to comprehend large systems by presenting them at a level of abstraction at which a system’s high-level design can be easily understood . Moreover, at its best, architectural description exposes the high-level constraints on system design, as well as the rationale for making specific architectural choices.

2. Reuse: Architectural descriptions support reuse at multiple levels. Current work on reuse generally focuses on component libraries. Architectural design supports, in addition, both reuse of large components and also frameworks into which components can be
integrated. Existing work on domain-specific software architectures, reference frameworks, and architectural design patterns has already begun to provide evidence for this.

3. Construction: An architectural description provides a partial blueprint for development by indicating the major components and dependencies between them. For example, a layered view of an architecture typically documents abstraction boundaries between
parts of a system’s implementation, clearly identifying the major internal system interfaces, and constraining what parts of a system may rely on services provided by other parts.

4. Evolution: Software architecture can expose the dimensions along which a system is expected to evolve. By making explicit the “load-bearing walls” of a system, system maintainers can better understand the ramifications of changes, and thereby more accurately estimate costs of modifications. Moreover, architectural descriptions separate concerns about the functionality of a component from the ways in which that component is connected to (interacts with) other components, by clearly distinguishing between components and mechanisms that
allow them to interact. This separation permits one to more easily change connection mechanisms to handle evolving concerns about performance interoperability,prototyping, and reuse.

5. Analysis: Architectural descriptions provide new opportunities for analysis, including system consistency checking, conformance to constraints imposed by an architectural style, conformance to quality attributes , dependence analysis,and domain-specific analyses for architectures built in specific styles.

6. Management: Experience has shown that successful projects view achievement of a viable software architecture as a key milestone in an industrial software development process. Critical evaluation of an architecture typically leads to a much clearer understanding of requirements, implementation strategies, and potential risks.

SmartNavigation and why not to use it

18 October 2007 Steve Leave a comment

SmartNavigation seems to be a nice feature – it allows Internet Explorer to handle PostBacks in a very clever way. You don’t have to worry about having a long site – it will return to the point where you have been before. Or if you define some events – SmartNavigation will enable you to invoke the handlers without posting the page back to the server.

But: If you are going to program a serious website for users of different browsers (Netscape, Opera, Konqueror or Safari) you need to turn SmartNavigation off, because it simply doesn’t work with this kind of browsers.

Another aspect is the following behaviour reported in the newsgroups (and not verified by myself ;) : If you would like to put the focus on some objects of your page (i.e. textboxes), you usually use JavaScript:

   Page.RegisterClientScriptBlock(“focus”, _
     “document.<id-of-your-control>.focus();”)

or (VB.NET)

   Page.RegisterClientScriptBlock(“focus”, _
      “<script language=”"JavaScript”">” & _
         “document.<id-of-your-control>.focus();” & _
      “</script> ” & _
      “document..focus(); “)

But: Try it with SmartNavigation turned on: It simpy won’t work on some systems. The reasons are unknown, but it seems to be, as if IE won’t interpret the script correctly.

Sad, isn’t it?

Categories: .net 1.1, .net 2.0, .net 3.0

Intresting things about the Session in ASP.net

3 October 2007 Steve Leave a comment

If we have the session state enabled and we do not store anything in the session then the session Id will change every time a new request is made. This also means that a new session is created every time. But the sate is never saved as there is nothing to save. Note the session_Start event will not fire for every request. The session_start event will only fire once.

Another interesting stuff about session Id is that it does not changes after we have called the Session.Abondon() method or when the session times out. Even though Session State expires but the session ID remains same. The session Id will last as long as the browser session does.

Session Class has two methods. Session.Abondon() and Session.Clear(). Both the methods are used to clear the data in the session. But there is one difference between them. If we use Session.Abondon() then Session_end event will be fired and session_start event will be fired on the next request. The same is not true for session.Clear() method.

Categories: .net 1.1, .net 2.0, .net 3.0