Categories
ASP.NET C# Visual Studio

.NET ToString Format Specifiers

Standard Numeric Format Specifiers (C) Currency: . . . . . . . . ($123.00) (D) Decimal:. . . . . . . . . -123 (E) Scientific: . . . . . . . -1.234500E+002 (F) Fixed point:. . . . . . . -123.45 (G) General:. . . . . . . . […]

Categories
ASP.NET

Where is ASP.NET 3.5 in IIS?

.NET 3.5 is not a stand alone framework like v2.0 or v1.1 . It is just an extension of the 2.0 framework. See explanation

Categories
ASP.NET SQL Server

Securing .NET application and data

.NET Data Access Architecture Guide Lock Down IIS and SQL Server Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication Planning for Extranet or Internet Deployment Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication

Categories
ASP.NET C#

Ways to validate Phone Numbers in C#

using System; using System.Text.RegularExpressions; class RegexSubstitution { public static void Main() { string text = “124”; if ( !Regex.Match(text,@”^[1-9]\d{2}-[1-9]\d{2}-\d{4}$” ).Success ) { Console.WriteLine( “Invalid phone number”); } } } Validate Phone Number public bool IsValidUSPhone(string number) { return Regex.IsMatch(number, @”\(\d{3}\)\s\d{3}-\d{4}”); } Matching and Grouping Regular Expressions using Regex in C#

Categories
ASP.NET VB.NET Visual Studio

Sending Appointments to an Outlook 2007 Calendar from an ASP.NET 2.0 Web Site

Good article that uses VS 2005 to create an ASP.NET 2.0 web site that can create and send an calendar appointment to add to an Outlook 2007 calendar. Examples in both VB.NET and C# http://msdn.microsoft.com/en-us/library/bb655909.aspx

Categories
ASP.NET SQL SQL Server

Login failed for user ‘username’. The user is not associated with a trusted SQL Server connection.

The cause of this problem is the SQL server has been configured to operate in “Windows Authentication Mode (Windows Authentication)” and doesn’t allow the use of SQL accounts. This was the default setting in my case, I got the error after installing a new instance of SQL Server 2005. I was able to solve this […]

Categories
ASP.NET

HtmlMeta Class

private void AddMetaRefresh() { HtmlMeta metaValue = null; metaValue = new HtmlMeta(); metaValue.Attributes.Add(“http-equiv”, “refresh”); metaValue.Attributes.Add(“content”, Settings.AutoRefreshInterval.ToString()); this.Page.Header.Controls.Add(metaValue); }

Categories
ASP.NET

App_GlobalResources maps to a directory outside this application, which is not supported.

Problem I’ve created a very simple ASP.NET 2.0 application. I can run this with no problems using the Built-in Web Server. However, if I publish it and try running the application by typing http://localhost/talentdata/default.aspx directly in the browser window, I get the following error: Server Error in ‘/talentdata’ Application. The path ‘/talentdata/App_GlobalResources’ maps to a […]

Categories
ASP.NET C#

Access Selected GridViewRow in GridView

GridViewRow selectedRow = (GridViewRow)(((Control)e.CommandSource).NamingContainer);

Categories
ASP.NET

Gridview – Getting the RowIndex

The following syntax sets the rowindex equal to the specific row number: int rowindex = ((GridViewRow)((Control)e.CommandSource).Parent.Parent).RowIndex;