Search Results for "Karl Schwirz"

MVC4 Makes it Easier to Create Desktop and Mobile Web Applications

Last year I wrote an article that expressed the importance of developing not only desktop solutions but mobile ones as well.  Since then it has become increasingly important to present not only to a desktop market, but to a mobile one as well.
That said, this article isn’t about convincing you to move to a desktop-mobile solution.  The metrics in my previous article speak for themselves and have only gotten stronger in favor of mobile solutions as time has gone on.  This article is going to center on how you can easily achieve a mobile solution by leveraging your existing MVC 4 website and making a few configuration changes  to automatically render mobile views when a mobile device is detected.

Remote debugging your deployed code. Visual Studio 2010

Sometimes you can’t run a debugger in a local environment and you have to remotely debug your deployed code.  This can be a tricky process and if there is a missed step along the way, can prove to be a pretty annoying troubleshooting process.
NOTE: In order to run a remote debugging session successfully, you’re going to need locally the exact same code base that you’re running on the server.
First you’re going to want to RDP into the machine your code is deployed on. Go to the link below, download and install the remote debugging monitor.
http://www.microsoft.com/en-us/download/details.aspx?id=475
For our configuration we chose to not run the debugger as a service while going through the install wizard.
Here you might run into your first pitfall.  While the remote debugging configuration wizard and Visual Studio are more than capable of making the correct firewall adjustments some…

Troubleshooting : ‘This type of page not served’

Recently when deploying a site to IIS I got the following error.

I tried several troubleshooting options such as checking the IIS mapping configuration to see if the .aspx pages were an accepted page extension, folder permissions on the deployment folder,  and I knew for a fact that .net was correctly installed on my server.
After some more searching and trial and error we narrowed the problem down to the CustomError tag in the applications web.config file.  The mode attribute was set to “Off” and therefore when the application threw an error, in my case an unauthorized user signed in, it didn’t know what to do with the redirected webpage.
Once I set the Mode to “On” and followed the rest of the redirect settings my site came up and the issue was resolved.

IIS Deployment with Sub Applications : Web.Config parent dependency override

Recently when deploying an application out to IIS we had the need to deploy a sub application within the same domain.  Essentially, what we were trying to do was make the sub application an extension of the parent application, but live in separate app pools and the code base would be kept separate as well.
(ie: www.awesomeApp.com is the parent application and www.awesomeApp.com/subAwesomeApp is the separate sub application living in the same awesomeApp domain)
This is simple to set up in IIS, however, when we tried to deploy the second sub application we got this reoccurring error when we tried to hit www.awesomeApp.com/subAwesomeApp.
Server Error in ‘/subAwesomeApp Application.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type…

Automatically log errors with Elmah in ScriptService-WebService calls

If you’ve used Elmah logging in the past then you know it’s a very useful and easy to set up tool in your web applications.  However, when we encounter errors in web services we sometimes do not get the desired logging into the xml file or database, depending on how you have Elmah configured.  This is because when a error occurs in a script service enabled web service, the errors get serialized into JSON and returned to the ajax caller which is then take by the javascript to handle the exception.  The application is left unaware of the exception occurrence.
There is a way however, to intercept the message before it is returned to the front-end and log the error automatically the way we are used to with Elmah.
First we set up an ErrorHandlerFilter class which will override the default error…

Calling an ASP.Net web service using jQuery and JSON.

Let’s say you have a webpage where you need to call a service but cannot perform a post back.  Recently I was on a client engagement where we needed to improve page performance by dynamically loading a navigation tree with a potential for several thousand links.  We implemented a solution that would load each branch as the user clicked on the expanding icon by calling a web service via ajax and passing the required links back to the page and render them client side.  This saved immensely on the load time for the page and improved the user experience
This kind of solution can be applied to several situations such as complex data processing, dynamic loading, or combining them all into a seamless form submission process that would clear the form on post backs.
We can accomplish this process simply by grabbing…

Mobile Site Development becoming as important as Desktop.

In recent years, the boom in mobile devices has caused more and more users to abandon their desktop internet browsers and opt for the ones sitting in their pocket. As a result, nearly 10% of 2011’s internet traffic was attributed to mobile device browsers. As more people are browsing the internet in this manner, it is important that currently standing websites, as well as newly developed ones, also include mobile friendly pages in their site.
Many companies have followed models put forth by sites such as www.amazon.com, with their widely known desktop interface for purchasing products. When the mobile markets started to pick up they developed a mobile site that operates in much the same way, but offers a friendlier user experience for those viewing it on a smartphone screen. This move to a mobile intuitive platform can generate an increase…

BizTalk- SMTP E-Mail: Compress Attachment in Memory

When trying to send a message via the SMTP adapter in BizTalk we have the option of attaching messages as part of Multi-Part Messages.  If the message being attached is too large the message will fail to send.  In our application, we send email notifications of failed messages in BizTalk with the original message sent as an attachment.
An solution we devised was to compress the original message and attach it to the email.  This solution, however, presented its own considerations.

We didn’t want to create a temporary directory on a server to create the compressed file in.  We wanted to do all of the compression in memory.
Since we were compressing in memory we had to come up with a solution to attach the file to the email message.

The compression in memory is discussed in my posting on File Compression In Memory. …

.NET File Compression in Memory

File compression is nothing new to .NET.  However, in many solutions it requires the developer to establish a file folder which they will write the compressed file to and later read from.
This solution cannot work if you want to compress and use the file in memory without writing to disk.  An example of this could be on a server where you don’t particularly want to have random processes writing to and reading files.
Listed below is a solution we came up with for compressing a file in memory. We used an open source library SharpZipLib from sharpDevelop.net.  There are other good options out there that could also be used.  We found that using this library offered the most intuitive solution to creating the archive file.
The result will be a Stream which can be used to send the compressed data to an…

Modularizing .NET Training Part 2

In our previous post we introduced the idea of sub-modularizing our training modules. In the course of developing for this blog posting our focus shifted to a bigger picture for this type of training.  Instead of presenting the differences between training in ASP.NET and MVC, we are now focused on proper architecture of an application, code reusability, and a focus on unit testing throughout our training.
Sub-modularizing our training modules allows for new trainees to think about how we can architect a layered application.  Building our current ASP.NET application, the trainee can know that their workflow and data access will be reused in the future.  This will allow him/her to develop with the flexibility required to reuse the function down the road.
A requirement of our current ASP.NET application builds a login screen which prompts the user for a User Name and…

\\\