Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

Do you feel like a little Assembly Language with your ASP.NET?

November 7, 2007 by Rob Bazinet

Tweet

This one is for some of you old timers (me included) who may have started out with x86 assembly language programming and you find yourself drifting off on your day job of writing ASP.NET and C#.  Well, here you go:

ASP.NET: ASM to IL compiler:

asmil

Check it out and remember the old days.  Heck, maybe you can find some applications that have a need for speed.   Actually, I doubt you will gain any speed but it is way cool.

Technorati Tags: ASP.NET, Assembly

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

ASP.NET Development Server Problems Under Vista

October 25, 2007 by Rob Bazinet

Tweet

I guess I was bored last night so I decided to upgrade my development system to Vista.  I have been running Windows XP Pro without any real issues but I wanted to start using some of the features of Vista I had only used in my virtual machines.

The upgrade went pretty well with only a handful of driver issues for video, printer and my sound card.

I installed the Visual Studio 2005 updates to run on Vista outlined by Microsoft and Visual Studio seemed to run just fine.    Note that ASP.NET is not installed by default, so you will need to enable it.

I normally use the ASP.NET Development Server for ASP.NET applications for development and testing and move over to IIS for deployment.   The only real problem I faced was hitting Ctrl-F5 in Visual Studio 2005 to run one of my web applications, the server started, Internet Explorer opened but nothing happened.  I waited for several minutes, but nothing.

After searching the web many different ways I found out that Vista implements IPv6 (versus the old IPv4) and browsers may have issues resolving http://localhost.  Since I use both Internet Explorer and Firefox for web development I decided to try just copying the URL the ASP.NET Development Server was using and pasting manually into both browsers and the same result…nothing, no error, nothing.

It turns out others have had this same problem and you can turn off IPv6 in Firefox pretty easily.

Disable IPv6 in Firefox
  1. Type about:config in the address bar and press Enter.
  2. Scroll down until you find network.dns.disableIPv6.
  3. Double-click on it to change its value to true.
  4. Restart Firefox.

After restarting Firefox I pasted the address used by ASP.NET Development Server into the Firefox address bar….and it worked like a charm.  So, it seems IPv6 is the issue.

I spent an hour or so trying to find a similar configuration for Internet Explorer but had no luck.  If a reader finds a setting in IE to disable IPv6 I would like to hear about it so I can update this post.

The solution I did get to work in IE was to disable IPv6 for my system.  I found a great article by the Cable Guy which pointed out what to do.   In short I set the following key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters\DisabledComponents

to a value of 0xff and restarted the system.  Checking the ASP.NET Development Server URL in the IE address bar displayed my page.

Conclusion

This worked for me but I have reservations about the solution.  What are the side-effects or the future effects of disabling IPv6 which Microsoft includes with Vista.  If the system evolves and I need IPv6 then I will have a different problem.

If someone has a different solution I would like to hear it.  I am not keen on disabling IPv6 but it works and it is not irreversible.  On the plus side, browsing the web seems to be faster.

Technorati Tags: Microsoft, Vista, Visual Studio 2005, IPv6

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

ELMAH – Google Code

July 10, 2007 by Rob Bazinet

Tweet

I have blogged in the past about using ELMAH (Error Logging Modules and Handlers) for error logging in my ASP.NET applications.   I still use it and love it, still one of the best tools out there.

The project has moved from GotDotNet, which Microsoft abandoned in favor of CodePlex, to Google Code.   You can find it here – elmah – Google Code

Technorati Tags: ELMAH, .NET

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

Great ASP.NET 2.0 Tips and Tricks List

August 2, 2006 by Rob Bazinet

Tweet

In case you are one of the only people writing ASP.NET code who do not know who Scott Guthrie is, you should check out his site. Scott recently posted a list of what he felt was the best ASP.NET 2.0 Tips and Tricks from better than 200 posts he made over the past year.? Scott’s posts are top-notch and I always learn something new. Technorati Tags : ASP.NET, Visual Studio 2005, Microsoft

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

ELMAH for ASP.NET 2.0 Available

July 16, 2006 by Rob Bazinet

Tweet

I have been using a module for Error Logging and Notification released on GotDotNet, called ELMAH.? ELMAH is a great behind-the-scenes module for ASP.NET that is quickly added to your project’s /bin folder, add a?handler in your web.config and run a script to create a table in your database.?? ELMAH logs errors to my SQL Server Database and allows me to quickly know if an error has occurred.? I can also configure the module to email me to get early notification.? I have been using ELMAH for the past year or so and would be lost without it.? The latest release is built for ASP.NET 2.0.? I used the one built for ASP.NET 1.1 without any problems.? The new version has some nice updates like using System.Net.Mail instead of the troublesome CDONTS. Here you can see a sample of the error reporting: elmahlog.jpg Please give ELMAH a try, it’s well worth the few minutes to set it up. Technorati Tags: ASP.NET

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

Application_Start not firing and the Global.asax

February 24, 2006 by Rob Bazinet

Tweet

I am working on a project in which we converted an existing Visual Studio 2003 C# web application to Visual Studio 2005. I can and probably post a series of entries on all of the issues we faced converting this project but that is for another time. The converted application has been running fine on our development systems pretty well since the conversion occurred. We recently put together some build scripts so we could get our build machine into action. Our build system integrates to our Sourcegear Vault repository, gets the latest code builds from the command line and deploys to a staging server. We got the kinks worked out of our build and deploy process and decided to start testing the application on our staging server. The application fired up and we were able to login without any problems but when going to a page that had controls from Peterblum.com the page would not render and complained about the location of the license files. If any of you have not used the Peter Blum controls they are great controls and Peter offers great support. The only real drawback to them is getting the right files in the right directory and setting a license property on the controls to get his licensing scheme to work. It is a pretty straight-forward task if you do it all the time but we install and forget about it. I went back through the Peter Blum documentation (very good by the way) and tried to see if something was missing in our deployment scripts that would put the license files in the wrong location. This checked out Ok. After a careful debugging session we determined what was happening. The Problem In order to properly setup Peter Blum controls you need to set a license key propery on the controls we are using. This can be done in the Application_Start of the global.asax OR in a place like the Page_load of every page using the controls. The obvious place to set this key is in the Application_Start if you are using these controls in more than one form. This is how we have our configuration. In this configuration our application works fine on our Windows XP development systems but when deployed to a Windows 2003 server running IIS 6 the Application_Start fails to fire. What? You may ask. Yes, it’s true the event we need to fire is not firing. Since we don’t have any real way to debug such a problem on the staging system I changed the place the license key was being set, the Page_Load event. Upon doing this the form loaded fine and the Peter Blum controls worked as before. How can this be happening is the question I had. The Solution It turns out that the problems starts in our .NET 1.1 version of the application and how 1.1 handled the global.asax. This file has a code-behind page named global.asax.cs and all the code you would use for global events such as the Application_Start would be setup in there. This is how we setup ours. As I mentioned, we used the conversion tool in Visual Studio 2005 to convert our web application to .NET 2.0 this way. The conversion ran fine but put the global.asax.cs file in the new App_code directory. This is a bad thing, for some reason the conversion thought it needed to be in there and on development it worked fine so we left it in there. All things pointed to this as the problem. We took the code in the global.asax.cs file and put it in the global.asax removing the gloabal.asax.cs file from our project and re-ran the build scripts, tested and all was good. The Application_Start fired once again. As of ASP.NET 2.0 the global.asax is only one file with no code-behind. I don’t know why the project ever worked as it was but this fixed the problem. Apparently there is a bug in the VS 2005 web application conversion tool that Microsoft should take a look at. Technorati Tags: ASP.NET, C#, Microsoft, Visual Studio

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

Dynamically Adding User and Web Controls

September 4, 2005 by Rob Bazinet

Tweet

I often make use of user controls for my web applications.   User controls are nice componentized chunks of HTML and .NET web controls combined and delivered as chunks of reusable code.

Much of the time these controls are dropped on a form much like using a server control.   In my current project I had the pleasure of using user controls dynamically.   Dynamically adding user controls to a form is a bit different than dynamically adding a standard server control.

Dynamically adding a web control:

        public class WebForm1 : System.Web.UI.Page
        {
            // Added by hand; will create instance in OnInit.
            protected System.Web.UI.WebControls.TextBox TextBox1;
            protected System.Web.UI.WebControls.TextBox TextBox2;
 
            override protected void OnInit(EventArgs e)
            {
                // Create dynamic controls here.
                TextBox1 = new TextBox();
                TextBox1.ID = "TextBox1";
                Form1.Controls.Add(TextBox1);
 
                TextBox2 = new TextBox();
                TextBox2.ID = "TextBox2";
                Form1.Controls.Add(TextBox2);
            }        
        }
    }

Dynamically adding a user control:

        private void Page_Init(object sender, System.EventArgs e)
        {
            int index=0;
            foreach (ProgramOptInQuestion poq in poi.Questions)
            {
                TableRow r = new TableRow();
 
                // load the user control. 
                QuestionUI question = (QuestionUI)[email protected]"~\Common\UserControls\Components\QuestionUI.ascx"); 
 
                // This table cell is run server-side and has a Control Collection associated with it.
                // Add the control to this collection.  
                // Could be done in the Page class but done here to allow for positioning.
                TableCell c = new TableCell();
                c.Controls.Add(question);
                r.Cells.Add(c);
 
                // append a new row to our table
                this.QuestionTable.Rows.Add(r);
            }
        }

The purpose of this code is to iterate through a collection of questions and load each question dynamically.

Notice the difference between the  two pieces of code.  Dynamically adding the user control requires the control to be loaded using the LoadControl method.

If you have never added web controls or user controls dynamically, it’s worth noting that the controls are actually added in the OnInit() and added to the Controls collection of an object.

Note – we use the OnInit() to load each web and user control because the Page object has all it’s controls added each time the page is rendered.  The first example adds the Textbox controls to the Controls collection of the form object.  The user controls are added to a cell that has the RunAt="Server" set and therefore has a Controls collection to work with.  This is subtle, but a detail worth noting.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

Major Changes for Visual Web Developer 2005 and ASP.NET 2.0 from Whidbey Beta 2 to RTM

August 28, 2005 by Rob Bazinet

Tweet

In case you haven’t heard about the Major Changes for Visual Web Developer 2005 and ASP.NET 2.0 from Whidbey Beta 2 to RTM, this article is worth a look.

Some of the changes are fixes and others are major updates developers have demanded.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

New ASP.NET 1.x to 2.0 Upgrade Center

July 28, 2005 by Rob Bazinet

Tweet

Microsoft has just released a new section of the MSDN web site for those developers upgrading from ASP.NET 1.x to ASP.NET 2.0.  Check it out.

A couple of the articles I found most interesting:

  • Common ASP.NET 2.0 Conversion Issues and Solutions
  • Migrating from ASP.NET 1.x to ASP.NET 2.0

My day job includes a mix of C# development on .NET 1.1 and 2.0 with most development moving to 2.0 in the near future.  We use Telerik radControls for much of our ASP.NET user interface and Telerik has yet to give us a set of controls we can use with VS 2005.  Once this occurs we will probably converting all of our existing ASP.NET 1.1 code to 2.0. 

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: ASP.NET

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • This is so true and has been my personal take on people complaining they are busy - https://t.co/YW8NTQLXtl
    about 3 days ago
  • Wow…https://t.co/h94ia053sL
    about 4 days ago
  • My Bills lost today but more importantly so did the Dallas Cowboys. Nice seeing the ‘boys done for the season.
    about 5 days ago
  • It looks like the Apple Xcode command line tools is a bit bloated for it to take this long… https://t.co/U0HObTvzXf
    about 2 months ago
  • How many people are mad that @elonmusk bought Twitter yet own or plan to own a Tesla? I bet many.
    about 2 months ago
  • RSS - Posts
  • RSS - Comments