Posts Tagged ‘asp.net’

Are Server Controls Still Useful?

// October 15th, 2008 // Comments Off on Are Server Controls Still Useful? // .net, asp.net

Dino Esposito wrote an article about how useful are server controls nowadays.  In my opinion, Server Controls have a place in the world. But as always, you have to take the requirements into consideration before choosing the technology to use.

Server Controls Advantages:
* Enhanced Productivity: It is very easy and fast to use server controls in ASP.Net, a lot of work went into creating such controls, and they are extremely useful and easy to use.
* HTML Uniformity: In ASP.Net Server Controls can be added with just like simple HTML tags, which makes your code uniform.

Server Controls Disadvantages:
* Not for High Performance Expectations: This doesn’t mean that Server controls have very low performance, it is just not for the use as high performance tool. The easy of use they provide, hit the performance as most of the time.

I Googled a little bit more and found this great article which explains the Pros and Cons of using Server Controls in a more comprehensive list.

Wicked Code

// August 5th, 2007 // Comments Off on Wicked Code // .net, asp.net, software development

I was just reading Abhi’s latest post about C# Compiler Mysteries . He talks about a piece of code that seems to emit an compiler error:

public static void Main()
{
    if(true)
        int i;
}

The main reason why this code emits an error, is that without the braces there is no use for that variable since it will go out of scope right away after creation. This is also true to the following code:

public static void Main()
{
    if(true) {
        int i;
    }
}

There is one difference though: Intention. With the first code, there is no intention, since without the braces there is nothing more to come, that variable will be out of scope the moment it is created; but in the second snippet of code, there is intention to use that variable later on.

I did the test on snippet compiler, and I was able to reproduce it:

This is the failed case:
Intention Mystery Failed Case

This is the success case:
Intention Mystery Success Case

I recommend you go and read the post by Abhi, it has links to resources that actually explain the error, and why the .Net Framework team thought about it.

Profiles and Web Applications

// April 19th, 2007 // Comments Off on Profiles and Web Applications // .net, asp.net

I was recently migrating a project from a Website Project to a Web Application Project (WAP) in Visual Studio 2005. This is completely new to me, since I’m mostly a Middle Tier fan. So we had extensive use of Profiles in our Website project, and when migrating the application broke. Specifically code that was in Code Behind had compilation errors while trying to find the Profile object.

Since this object is compiled and instantiated at run-time, VS didn’t seem to find it. So this I spent several hours trying to find a solution, and the only one I could figure out, was to write the damn Profile class, and included it in my project, so I began doing that., when I was about finished with my Profile implementation, I found this article.

As it seems the main reason why this doesn’t work is because of the way Web Applications are compiled. This is the complete answer provided by one of the Asp.Net Team in this forum:

This is not so much a bug as a difference in compilation models between web sites and web application projects. See the profile topic in the following for some more info:

http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

The basic issue is that profiles are compiled dynamically by ASP.Net. In web sites your code files are also compiled dynamically by ASP.Net. So, ASP.Net is able to first compile the profiles and then add an accessor and reference to your page and compile it afterwards. In Web Application Projects your code files are compiled on the client. They can not have references to dynamically created assemblies that do not exist or they will not compile.

This is a general issue for ASP.Net BuildProviders and and Web Application Projects. We do not have a general solution yet. The two build providers we get the most questions about are App_GlobalResources and Profiles. For these two we are trying to come up with solutions. The thought is that we will generate proxy opjects that get compiled into your assembly on the client. The proxy objects for profiles will represent the state of the profiles in web.config at the time of compilation on the client. You will have strongly typed access to the profiles through the proxy. The proxy will work something like the sample code in the link above.

Tim McBride

This posting is provided “AS IS” with no warranties, and confers no rights.

Also in that forum, there is an Add-in to generate the Profile for Web Applications. I already installed it and tested, it works like a charm. It is not as seamless as I would like, since I have to instantiate the the Profile for each page, but it works. The Add-in is here.

I hope this helps, because I spent too many hours looking for a solution. And there is not enough information to make it work correctly.

Asp.Net vs J2EE

// March 7th, 2007 // Comments Off on Asp.Net vs J2EE // .net, Java

I just found an article about why MIT chose Asp.Net over J2EE considering the history that the MIT has with open source software.

It seems a very interesting read.

Using ASP.NET Calendar Control and Yahoo.UI.Calendar in ASP.NET

// November 6th, 2006 // Comments Off on Using ASP.NET Calendar Control and Yahoo.UI.Calendar in ASP.NET // .net, software development

Check-out this article…. I think it is very interesting…