Need to get the .com, .us, .biz, etc. part of the domain name in .NET? Here’s how: Dim root As String root = Right(Request.Url.Host, (Request.Url.Host.Length) – InStrRev(Request.Url.Host, "."))Dim root As String root = Right(Request.Url.Host, (Request.Url.Host.Length) – InStrRev(Request.Url.Host, "."))
Tag: .net
Rename an email attachment before sending in .NET
I recently had the need to send an email with a file attachment from disk. The problem I faced was that the filename was not very user friendly at all. What I didn’t want to do however was rename the file on disk, or create another copy of the file with a more generic name, that could create conflicts with…
How to use the My Namespace in C#
When I was first trying to transition from VB.NET to C# I found it pretty odd that the “My” Namespace wasn’t available in C#. If you aren’t aware of what I’m talking about, the Microsoft.VisualBasic.MyServices namespace (My in Visual Basic) provides easy and intuitive access to a number of .NET Framework classes, enabling you to write code that interacts with the computer,…
CMAP Main Meeting – Tuesday, December 7th – IIS Express, Razor, and WebMatrix, OH my!
CMAP Main Meeting – Tuesday, December 7th – IIS Express, Razor, and WebMatrix, OH my! – G. Andrew Duthie When: Tuesday, November 7th, 6:30 PM – 9:00 PM Where: HCC Business Training Center, 6751 Columbia Gateway Drive, MD, 21046 Topic: IIS Express, Razor, and WebMatrix, OH my! Does the announcement of so many new technologies make you wonder where the…
Going for MCTS certification on Visual Studio 2008
I have been dragging my feet for the past few years in regards to finishing up my Microsoft development certification. Actually, the last test I took was 70-229 Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition back on Dec 08, 2003. WOW, I had no idea it was that long until I just looked it up. Anyway,…
FredNUG tonight
I’ll be attending the Frederick .NET user group tonight. Tonight’s topics will be SQL Server Performance and Coding for Fun and Profit. More information can be found here.
FormView and ObjectDataSource with nullable types
I recently ran into this problem when using a FormView and and ObjectDataSource where the FormView was binding to nullable data types… Here is a challenging question, as I have not found any suitable information on this after two days of searching: Background: I have a custom Business Class library that includes custom objects with nullable int and DateTime properties.…
FormView not retaining values when server-side validation fails
I recently spent quite a bit of time trying to figure out why my FormView wasn’t retaining values after some of my custom server-side validation failed in my business logic layer. I kept seeing that you just had to set KeepInEditMode = true (or KeepInInsertMode if you’re doing an insert) and that would take care of it. Well, after a…