Geeks With Blogs
ken spencer May 2011 Entries
MVC: Error '__o' is not declared. It may be inaccessible due to its protection level.
This error drives me nuts frequently when editing a .ASPX page. Its really weird. And of course I have this code at the top of the page: <%-- The following line works around an ASP.NET compiler warning --%> <%: ""%> Today I figured out that sometimes I think VS just gets confused. For instance, this line might work just fine: <%= SomeVar %> Then again it might generate that error above. The only real fix I have found for those lines is to replace = with Response.Write which = is ......

Posted On Tuesday, May 31, 2011 2:46 PM

C# to VB
I do a ton of work in both C# and VB. Both are great but sometimes I find stuff in C# that I need to convert to VB. I recently found this tool that helps greatly. I used this today to convert a bit of C# I found for MVC. The results are shown below: Nice tool so far ......

Posted On Wednesday, May 25, 2011 1:39 PM

MVC: Unit Testing Temp Data
Doing more unit testing and I ran across this nice article on mocking up TempData. That’s great because tempdata is used a lot in controllers and you need a way to mock it for unit testing. Again, this code is in C#, so I will show you the vb version. Hres the StubTempDataHttpSessionState class: Imports System.Web.Mvc Imports System.Web ''' <summary> ''' HttpSessionState for TempData ......

Posted On Wednesday, May 25, 2011 1:37 PM

MVC. Unit testing and mocking the http context
I was working on unit testing today for an MVC application and needed to mock up the http context for an action method. I found this article that shows how to do this nicely. http://bradwilson.typepad.c... Yeah, I know, you can do this with rhino mock and others. But this works too. I converted this to VB so I could use it in the same project. Heres the vb code: Imports System.Collections.Specialized Imports System.Web Public Class ......

Posted On Tuesday, May 24, 2011 3:05 PM

Copyright © xamlnotes | Powered by: