ASPNET

There are 5 entries for the tag ASPNET

ADO.NET Entity Framework – Code First Development Pattern

Here’s a quick start introduction to the ADO.NET Entity Framework Code First Development Pattern. For a more complete (but still intro) walkthrough, check out ScottGu’s blog. At the time of this writing, you’ll need the EF 4.1 Release Candidate. After EF 4.1 is released you’ll no doubt be able to find it on the ADO.NET team blog. 1. Create a new empty ASP.NET MVC2 Web Application, add a reference to System.Data.Entity. If using the EF4.1 RC - add a reference to the EntityFramework dll that comes...

Posted On Thursday, April 14, 2011 3:42 AM | Feedback (0)

Setting a Master Page Dynamically

To set an ASPNET master page dynamically, use the Page_PreInit function and set the Page.MasterPageFile property. For example: protected void Page_PreInit(object sender, EventArgs e) { this.Page.MasterPageFile = "~/MasterPages/" + mymaster + ".Master"; } In the above example, mymaster should be set by whatever your requirements dictate – read from DB/CMS/whatever. The page (aspx) itself shouldn’t have any other reference to the master page (ie, no “MasterPageFile attribute in the page directive),...

Posted On Tuesday, August 17, 2010 3:04 PM | Feedback (2)

CSharp TruncateAtWhitespace Function

Here’s a TruncateAtWhitespace function that takes an incoming parameter value and an incoming max length, and returns a substring broken at a whitespace position. This way if you have “Lance has a blog” and you need to truncate it to 8 characters or less, you get “Lance” instead of “Lance ha”. /// <summary> /// Truncate at the end of a word /// </summary> /// <param name="value">The original string</param> /// <param name="maxlength">The maximum length of string to return</param>...

Posted On Monday, August 16, 2010 3:28 PM | Feedback (0)

Dynamic Configuration of Log4Net

I needed to dynamically configure log4net – outside of the web.config file. Here is my solution: 1. All that configuration of log4net in web.config? Forget it. 2. Create a separate log4net.config file (name it whatever you want), with the usual configuration content in it defining whatever appenders you want. For example if you want a rolling file log: <log4net> <appender name="RollingLogFileAppender" type="log4net.Appender.Roll... <param name="File" value="C:\\Temp\\mylog.txt"...

Posted On Friday, August 13, 2010 7:18 PM | Feedback (0)

WebHost4Life

I am considering opening an account with Webhost4life.com. Does anyone have any experience with them? Anyone have any other advice? I need a good Windows hosting company where I can be use ASPNET apps like DNN or dasBlog without any issues. Update: I did go with Webhost4life, and they were great at the beginning. Their support was friendly and helpful, and my site was fast. That was then, this is now. It seems in this short time, they have gone to absolute crap. Their support appears to be all non-technical...

Posted On Saturday, July 30, 2005 4:57 PM | Feedback (59)

Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski