New AJAX Control Toolkit Version Released - May 2011

by Johnny Nouel 12. mayo 2011 09:08
A new version of the famous AJAX Control Toolkit has been spotted in Codeplex.  Stephen Walter made the announcement yesterday in this blog post.  This post details the enhancements and bug corrections addressed in this released.  The controls that received the most attention were ModalPopup and AsyncFileUpload. Links Download AJAX Control Toolkit Stephen Walter's Blog Post about this new version Download and read that. Cheers!

Tags: , , ,

ASP.NET

Converting BlogEngine.NET 2.0 to Web Application Project (WAP)

by Johnny Nouel 15. abril 2011 17:46
I've been running BlogEngine.NET on this Blog since its birth.  Started on version 1.5 and recently this year the BlogEngine team released version 2.0. I decided to migrate to this new version and before doing that I needed to convert the source files to the Web Application Project format.  For me, the WAP format makes more sense that the Web Site model introduced with Visual Studio 2005.  Since this is not a post on comparing the two alternatives I'll just let you follow this link that does exactly that. Moving on. For version 1.5 I proceeded and converted the solution to WAP also.  In this blog post from a fellow developer I found the instructions  on how to do so.  The instructions were almost perfect and only few things needed attention to have the BlogEngine running as it should. This time, for version 2.0, the BlogEngine.NET Codeplex site had the instructions to complete the process on this page .  The instructions are now less in number and they even look a lot cleaner that what we had for version 1.5.  At the end of the step by step instructions, in the Conclusion section, it says that "you don't need to make any changes to the code itself as it was a case in earlier versions".   In my case I did have to make changes to the code in order to make the application work.  Here is my list of changes: Open the property page for the BlogEngine.NET project and set the new name for the Assembly and Namespace.  Let's agree on "BlogEngine". In the Utils.cs file in the BlogEngine.Core project locate the line that sets the assemblyName variable and set its value to the Assembly name that was selected in the previous step.  "BlogEngine".   Do the same for the line that sets the Assembly Name when the check for "IsMono" is made. public static IEnumerable<Assembly> CodeAssemblies() { var codeAssemblies = new List<Assembly>(); CompilationSection s = null; //WAP FIX //var assemblyName = "__code"; var assemblyName = "BlogEngine"; try { try { s = (CompilationSection)WebConfigurationManager.GetSection("system.web/compilation"); } catch (SecurityException) { // No read permissions on web.config due to the trust level (must be High or Full) } if (s != null && s.CodeSubDirectories != null && s.CodeSubDirectories.Count > 0) { for (var i = 0; i < s.CodeSubDirectories.Count; i++) { assemblyName = string.Format("App_SubCode_{0}", s.CodeSubDirectories[i].DirectoryName); codeAssemblies.Add(Assembly.Load(assemblyName)); } } else { if (!IsMono) { //WAP FIX //assemblyName = "App_Code"; assemblyName = "BlogEngine"; } codeAssemblies.Add(Assembly.Load(assemblyName)); } codeAssemblies.AddRange(GetCompiledExtensions()); } catch (FileNotFoundException) { /*ignore - code directory has no files*/ } return codeAssemblies; } Please note that I include the "WAP FIX" comment anywhere I make a fix in order to make this WAP work.   In the Web.Config file make the following addition of the assembly name in the Pages section: <pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> <controls> <!--WAP FIX--> <!--<add namespace="App_Code.Controls" tagPrefix="blog"/>--> <add assembly="BlogEngine" namespace="App_Code.Controls" tagPrefix="blog"/> </controls> </pages> In order to make the extensions work again you need to make a change in the Editor.ascx.cs file in the "admin\Extension Manager" folder.   Since the App_Code folder had to be renamed to something else you need to let the engine know where to find the extensions now.  In my case I named the folder "Classes".  Neat huh?  Here's the change in the file: protected static string GetExtFileName() { var fileName = HttpContext.Current.Request.PhysicalApplicationPath; var codeAssemblies = Utils.CodeAssemblies(); foreach (Assembly a in codeAssemblies) { var types = a.GetTypes(); foreach (var type in types.Where(type => type.Name == ExtensionName)) { var assemblyName = type.Assembly.FullName.Split(".".ToCharArray())[0]; assemblyName = assemblyName.Replace("App_SubCode_", "App_Code\\"); var fileExt = assemblyName.Contains("VB_Code") ? ".vb" : ".cs"; //WAP FIX //fileName += Path.Combine(Path.Combine(assemblyName, "Extensions"), ExtensionName + fileExt); fileName += Path.Combine("Classes\\Extensions", ExtensionName + fileExt); } } return fileName; } Now, that should do it.  But no. we're not done yet.  Somehow, the classes and files in the admin folder have the classes names and namespaces messed up!  For example, the menu.ascx.cs file had the namespace set to "admin.Settings" when it should be "Admin.Posts".  Note the casing there as well.  Even the casing in the naming was confusing.    Check the namespaces, classes names, and the inherits value in the page directive of the ascx files also.  They should match the directory where they are at least. Menu.ascx.cs file under Admin/Posts folder: //WAP FIX namespace Admin.Posts // Namespaces were a mess. This was "admin.Settings". Everything inside the admin folder // had to be checked and corrected. { using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Menu : System.Web.UI.UserControl Comments.ascx.cs file under Admin/Settings folder: //WAP FIX namespace Admin.Settings //This was "Admin.Comments". I won't comment the other changes in namespaces in the admin folder. { using System; using System.Data; using System.Web.UI.WebControls; using BlogEngine.Core; using BlogEngine.Core.Web.Extensions; using App_Code; //WAP FIX -> Fixed Class Name which was 'Settings'. public partial class Comments : System.Web.UI.Page And that's it! That's all we need to make the WAP Project for BlogEngine.NET.  But I'm a lot nicer.  Please download the whole BlogEngine.NET Project in WAP Format below.  The Web.Config in the project is the one for SQL Server.  The original one I named "Web ORIGINAL.config".  See what I did there? Update: Forgot to mention that the download below has the BlogEngine.NET Project now targeting .NET Framework 4.0 instead of 3.5.  Enjoy! Download BlogEngine.NET 2.0 WAP Source Code Cheers!

Tags: , , , ,

ASP.NET | BlogEngine.NET

Moving Your Application to ASP.NET 4

by Johnny Nouel 26. marzo 2011 21:57
About a year ago I read the following blog post by Scott Hanselman. It warns you on stuff you should take into consideration when moving your application to the ASP.NET 4 application pool. Even though I read that article about a year ago I forgot all about it when I decided to switch the application pool to ASP.NET 4 for this little blog here you're reading. I was running BlogEngine 1.5.0.7 under ASP.NET 3.5 and made the switch. BAM! Whenever I tried to post some data into my blog using the built-in editor the error above appeared. Of course that was not the page I got when the error happened as I had CustomErrors turned on. I replicated the issue on my machine and saw the Yellow Screen of Death. Thankfully the error description was self explanatory and even pointed the solution to the reader. Now I remembered Scott Hanselman's post. Since ASP.NET 4 has a more strict validation as opposed to ASP.NET 2.0-3.5 you may have to revert to the old settings if you wish to have the old behavior activated. Just add the following in the httpRuntime element of the web.config file. <httpRuntime requestValidationMode="2.0"/> ASP.NET 4 is trying to protect you against Script Attacks. You can also check and sanitize your web application's input and avoid the error. What to read: Scott Hanselman's post. ASP.NET 4 Breaking Changes Request Validation: Preventing Script Attacks Soon I'll be upgrading the Blog to BlogEngine 2.0 running under ASP.NET 4. Happy Programming.

Tags: , ,

ASP.NET | Development

Entity Framework - Methods missing from Entities Object

by Johnny Nouel 22. marzo 2011 20:02
I had a difficult time trying to decide the title of this post.  I couldn't decide between the current title and "Entities from outer space invade .NET and steal its methods".  Of course I know you agree with my current selection. The thing is that I'm actually kind of new to the EF ORM.  And as I go along using it in my new project issues and discoveries come to my attention.  Some of them are plain silly and others hidden even from Google and Bing (or so I thought). I developed a Class Library which contains the EF Model for one of the databases I'm working on.  I then add this library as a reference in another project in order to consume it.  The thing is that the Entities Object was not exposing some of the properties or methods that were available in the Class Library. Let's suppose I just built a Library that works against the Pubs Database.  I added a reference to this project in a Windows Forms project. I have a method called GetData that instantiates the pubsEntities object and when Intellisense does its magic some methods like SaveChanges are missing.  Also, the properties and methods of tables are gone as well.  Take a look: The SaveChanges method is nowhere to be seen.  At first I tried to figure it out without trying to compile the application but the problem was staring at my face and did not want to see it.  After compiling and hovering the mouse over the underlined issues in the code you could easily read that an assembly was missing. Yes.  That's right! All you have to do is add the System.Data.Entity assembly to the project consuming the EF Class Library and voila!  All methods are back! The code now looks ok (it does now that I changed the method name from GetData to AddSomeAuthor): private void AddSomeAuthor() { Pubs.pubsEntities db = new Pubs.pubsEntities(); Pubs.author author= new Pubs.author(); author.au_id="JN"; db.authors.AddObject(author); db.SaveChanges(); } Cheers!

Tags: , , ,

ASP.NET | EntityFramework

ASP.NET MVC 2 Released

by Johnny Nouel 14. marzo 2010 18:09
On March 11th Microsoft released the RTM Version of ASP.NET MVC 2.  It has been almost a year since the released of version 1 last year of the now very popular alternative to writing web applications on the .NET Framework using the Model-View-Controller pattern (MVC). Please remember you can install ASP.NET MVC 2 side by side with ASP.NET MVC 1. Please follow the links below in order to download the bits and to read the latest information regarding the changes since the first version. ASP.NET MVC official websiteand Download Page(Source code included). Scott Guthrie's blog post regarding this release. Instruction on upgrading ASP.NET MVC 1 applications to version 2 with Visual Studio 2008. What's new in ASP.NET MVC 2 Happy programming!

Tags: , ,

ASP.NET | MVC

ASP.NET MVC 2 Preview 2 is out

by Johnny Nouel 4. octubre 2009 14:56
4 days ago Microsoft released ASP.NET MVC 2 Preview 2.  The last update to the upcoming update to the now popular MVC Framework for ASP.NET.  Please head over to this link to download it. Remember that this preview can be installed side by side with ASP.NET MVC 1. Happy programming

Tags: , , , , ,

ASP.NET | MVC

New AJAX Control Toolkit version released

by Johnny Nouel 1. octubre 2009 08:45
It's been a while since my last post.  Things have been kind of hectic at work and in life itself.  Overall is for the best.  But enough of me, today I saw that the AJAX Control Toolkit just got updated to a new version with a couple of new controls.   Please head to Codeplex to download the binaries and source code from this version. The new controls that were added to the the toolkit are: Seadragon.  This new control allows you to present pictures and interact with them by executing actions like zoom, pan, etc. AsyncFileUpload.  This new controls permits the upload of a file asynchronously (YES!).  No postback involved. Both controls definitely were on the top ten most wanted for the toolkit and we're glad to have them now. Please remember that this version of the toolkit works only on .NET Framework 3.5 and Visual Studio 2008. Happy programming

Tags: , , , , , ,

AJAX | ASP.NET

First ASP.NET MVC Framework Impressions

by Johnny Nouel 1. septiembre 2009 12:18
About 3 weeks ago I decided I should get my hands dirty on the new ASP.NET MVC Framework.  I started with the now famous NerdDinner application by following Scott Guthrie's 1st chapter where he built NerdDinner from scratch.  The NerdDinner application is hosted and available at CodePlex. I'm about 2/3 into the chapter (I need more time!) and so far it has been a complete paradigm change from WebForms.  WebForms was born at the right time when ASP.NET came out in order to help Windows Developers coming from other Development platform embrace more easily web development.  It totally succeeded. WebForms hid most of the http plumbing and provided a fast and easy framework for web development that became a hit almost instantly.  ASP.NET MVC isn't here to replace WebForms but rather to provide a different approach to web development based on the MVC model.  If you don't like it or don't feel comfortable, then it's ok.  You can continue working with WebForms.  But I suggest you make the choice after first trying it out. ASP.NET MVC MVC stands for Model-View-Controller and is a Software Design Pattern that promotes Separation of Concerns.  These are: Model.  This is your data.  The Data Access Layer and calculations of data exist here. View.  This is the user interface.  It's how the information is presented. Controller.  The Controller is the one responsible to process and respond to user interaction.  It decides what View should be rendered to the user. The main advantages I have experienced so far are: Total control of HTML output. Easier maintenance as you can work on any element without affecting the other. Cleaner code. Friendly URLs that help on SEO. No ViewState (YES!). Unit Testing. Some drawbacks: Goodbye old Web Controls. Regular ASP.NET AJAX functionality is lost. It might remind you of Classic ASP. In conclusion, to keep it short.  ASP.NET MVC is a huge refreshing change for web development, and most welcome.  It's going to take longer for WebForms developers to get the job done; much longer at first as we all learn since the Thinking needs shifting.  At the end, the final product will be more easily maintained and changed.  The Learning Curve is somewhat long but it pays off as you go along. Happy programming ;)

Tags: , , , ,

ASP.NET | MVC

Telerik ASP.NET MVC Extensions are released

by Johnny Nouel 12. agosto 2009 15:37
Telerik, a company that has been developing rich UI controls for the Microsoft .NET Framework released today its Telerik Extensions for ASP.NET MVC.  The extensions are Open Source, a first for Telerik as it embraces this approach hosting this solution on the Microsoft Open Source site Codeplex. This released is marked as a CTP (Community Technology Preview) and provides a nice UI extension for MVC.  It is based on the famous JQuery Javascript library which is supported by Microsoft. Related Links Telerik Extensions for ASP.NET MVC on Codeplex Telerik Product Page Demos Intro to Telerik Extensions for ASP.NET (Video) Personally ASP.NET MVC is the next big thing since Webforms and I'm enjoying every minute of this learning experience.  And totally applaud the support it's getting.  I suggest you go ahead and see if ASP.NET MVC is for you. Happy programming

Tags: , , , , ,

ASP.NET | MVC

The Microsoft Web Platform Installer

by Johnny Nouel 8. agosto 2009 17:04
Microsoft recently released the RC version of its now famous Web Platform Installer.  The Web Platform Installer is a compilation of powerful frameworks, servers, tools, database and popular open source web applications that can be installed from a single package and prepare your Windows machine to become a powerhouse in web development. You can download the Web Platform Installer directly here or visit its download page for more information. Now you don't have to visit different web pages to download those samples and starter kits you want.  This download manager will take care of this for you. It first greets you as you run it with a What's New section where you'll be introduced to the latest updates and additions to the platform so you don't have to worry about keeping up to date with all the releases and updates that are coming out.  In the Web Platform section you can install or customize you Web Server, Frameworks and Runtimes, Database and Development Tools installations. For example, if you click Customize on the Web Server option you will see the Features available for download and those already installed.  In the screenshot below we can see the URL Rewrite Module for IIS has not been installed yet. Even PHP is available in the Frameworks and Runtimes section.  They're now friends as you can see from this video. In the Web Applications section you will be treated to some of the most popular web apps today.  Even the Blog Engine which I run is there .  They have been also categorized for easy access in another menu inside this section. Let's now take a look at the What's New section screen from another machine running Windows XP with .NET 3.5 SP1, SQL Server 2005 Express and Visual Web Developer Express below.  Notice how the ASP.NET MVC 1.0 framework is offered along with Silverlight 3, SQL Server 2008 Express with SP1 and PHP in the Web Platform Extensions.    Give the Web Platform Installer a try and pat yourself on the back.  Good Job! Happy programming

Tags: , , , , , ,

ASP.NET | Database | MVC

Recent Posts

Sobre mi

Johnny Nouel Mi nombre es Johnny Nouel. Profesional de Tecnología.  Experto en SAP FI CO.  Especialista en SAP BW, BI y BO.  Desarrollador ASP.NET.  Amante de los Videojuegos y la Tecnología.  Aguilucho!

Contactame?