How to fix more problems with ASP.net MVC 3 RouteValues
The Problem You want to create urls that look something like https://SomeSite.com/Categories/Industrial/Fasteners/3.8-MM-Titanium-Wrench-Bolts/ so your site can rank extra high when people search for those profitable 3.8 MM Titanium Wrench Bolts. And in natural, RESTful fashion, your site and database is structured so that the Wrench Bolts are in a subcategory of Fasteners, which are part […]
How to fix problems with Linq to Xml Namespaces
The Problem You are trying to read data out of a standard xml file. I found a great Linq to Xml tutorial here. You get code that looks something like this XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath("~/Invoices.xml")); List<Invoice> lst = new List<Invoice>(); lst= (from c in data.Descendants("invoice") select new Invoice { ClientName = c.Element("client").Value, InvoiceDate = Convert.ToDateTime(c.Element("date").Value), }).ToList(); and you get nothing but object type no found errors. Why? You have problems with linq […]
How to fix alignment problems in IE 9
The Problem You have a beautiful, syntactically valid piece of html that SHOULD be aligned center in all browsers, and is aligned center in FireFox and Chrome, but refuses to align center in IE 9. The Cause I encountered this when I built the WordPress theme for this very blog. The cause of alignment problems […]
The how to fix series
I’ve done this elsewhere – but I’m going to start documenting any odd technical problems that take me more than 15 minutes to solve, largely so I have a reference when I have the same problem again. Everything will be in a “The Problem, The Cause, The Solution” format. There will be many posts in the […]
How to fix problems with the X-Axis in Microsoft Charting Components
The Problem: You’re creating a line or area chart using the Microsoft Charting components (the ones in System.Web.UI.DataVisualization.Charting, not System.Web.Helpers) and for whatever reason the first entry is actually in the second quadrant, like so: The Cause: The charting components assume you want to show some sort of contrast for the first value, but it […]
How to fix problems with asp.net, C# and Request.ServerVariables[“HTTP_REFERER”]
The Problem: I recently built a small web app that tracked downloads. Part of that was using the referring page. Somehow, for some reason, the url was not being sent along with the request. The Cause: After much travail, I finally noticed that the browser was on page https://www.somedomain.com and the link in question […]
How to fix problems with Coded User Interface Tests
The Problem: You attempt to create a new Coded User Interface Test in Visual Studio 2010, and you get the following error: The following package failed to load: C:Users[File Path Goes Here]Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll. Coded UI Test is now in an inconsistent state. Remove this package and restart Visual Studio to work with Coded UI Test. The […]
How to fix problems with Linq and the Entity Framework
The Problem: You attempt to do a query using Linq To Entities and your code does not work. The Cause: For reasons unknown, Linq to Entities has different operators than Linq To Sql. The Solution: Call your initial query/pull and us .ToList() on it before you run any of the problem operators – this fixes […]
How to fix problems uploading images in asp.net mvc 3/razor
The Problem: You are attempting to create create an asp.net mvc 3 page with razor that uses an upload control. You try to upload an image and all you get is a “server not available” error. Not very descriptive it it? The Cause: ASP.net sets the default upload limit very low. The Solution: Raise the limit, just […]
How to Fix the “Service Unavailable” problem in IIS
The Problem: For whatever reason, your website is displaying a white screen with “Service Unavailable” and nothing else. The Cause: There could be many causes, but the one I just discovered was that the application pool had shut down for no good reason. The Solution: In IIS, navigate to “Application Pools”, right click to bring […]