Posts Tagged ‘asp.net’

Adding items to a databound DropDownList

Wednesday, November 23rd, 2011

Use the AppendDataBoundItems property - see http://weblogs.asp.net/andrewrea/archive/2008/01/23/test-post.aspx

Sending emails in ASP.NET using System.Net.Mail

Monday, August 8th, 2011

Sending emails using System.Net.Mail, see http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx.

Includes information on configuration mail server in web.config.

Using SpecifiedPickupDirectory during web development

Monday, August 8th, 2011

Using SpecifiedPickupDirectory is something I only recently discovered. It’s a really nice development aid and prevents emails being sent to contacts in the development database, which is particularly useful when working with a sample of live data and you risk accidently firing off a round of automated emails to live email accounts during development.

Basically emails are created and stored in a specified local director instead of being sent to any email server for delivery. This way you can test and view generated emails without any risk of them actually being sent.

For more information see http://www.singular.co.nz/blog/archive/2007/11/28/using-an-smtp-pickup-directory-delivery-method-for-asp-net-development.aspx

and

http://www.singular.co.nz/blog/archive/2007/12/19/programmatically-setting-the-smtpclient-pickup-directory-location-at-runtime.aspx.

ASP.NET MVC 2.0 RTM Download

Friday, April 9th, 2010

When searching for ASP.NET MVC 2.0, the RC 2 version still appears higher in search engine results. Note however that the final release ASP.NET MVC 2 RTM is available. It is available from Microsoft’s site here.

Building ASP.NET web pages without Visual Studio.NET

Tuesday, January 26th, 2010

Related to the previous post, we were tasked with adding pages to an existing third-party ASP.NET web application without having access to the site’s existing code-behind files.

Although a slightly unusual situation, after a little digging around we found that it was quite easy to create the additional pages and integrate them into the website without the usual creation of a web project in Visual Studio.NET.  Instead each web page was created manually, here’s what was required:

For each web page create two files…

page.aspx.cs

Simply create a class that inherits from System.Web.UI.Page.  This will be the class that represents the web page.

namespace MyNamespace {

public partial class _Default : System.Web.UI.Page
{

}

}

page.aspx

Include the following directive at the top of the aspx page (assuming the aspx file uses a C# code behind file)

<% @ Page Language=”C#” CodeFile=”page.aspx.cs” Inherits=”MyNamespace._Default” Debug=”true” %>

Using namespaces in aspx files

Monday, January 25th, 2010

When developing ASP.NET web applications libraries are usually used by including them in the code behind files.  On a recent project, which involved maintenance of a client’s existing web application .NET libraries were required for use on the web page but there was no access to the page’s code-behind file.

There is a way to include required namespaces directly within aspx files - in the event that namespaces need to be imported within aspx files you can use the <%Import %> directive.

Example:

<%@ Import namespace=”Enter.Namespace.Here” %>