Categories
ASP.NET C# IIS

How to disable anonymous authentication in IIS Express

StackOverflow: IIS Express is automatically disabling anonymous authentication for my project, why? To disable anonymous authentication in IIS Express, I found updating the following element in the project files (i.e. csproj, vbproj) allowed me to debug my application with anonymous access. Changing the IISExpressAnonymousAuthentication setting to enabled fixes the issue (it can also be done […]

Categories
ASP.NET C# VB.NET

String.Format to set a constant in .NET

Today I began working on the base framework for a new project. In the past we would just copy an existing project and remove what we don’t need, so I thought this would be a good time to make the framework more generic to speed up this part of the process for future projects. This […]

Categories
ASP.NET C# SQL Server SSRS Visual Studio

SQL Server Reporting Services (SSRS) – Download Multiple RDL files

I needed to migrate multiple SSRS reports (.rdl’s) between environments (production -> qa ->development) and didn’t want to download/upload each individual report. I searched but couldn’t find a solution built into SSRS report manager, so I began my Google search. I found a solution on Code Project (SSRS Downloading .RDL Files) that worked after some […]

Categories
ASP.NET C# VB.NET Visual Studio

Here are some useful collection types commonly used in .NET

This is a question that was asked during an interview and I didn’t know the correct answer, so I thought I would add the information I found to “My Online Notepad“. Maybe it can also help someone else. Hash Tables – A collection of key/value pairs that are organized based on the hash code of […]

Categories
C# VB.NET Visual Studio XML

XML documentation parse error (warning in Visual Studio)

I was working with a VB.NET project today and noticed the following warning: XML documentation parse error: Whitespace is not allowed at this location. XML comment will be ignored. After a quick search on the web I found the problem was using the ‘&’ character which is a reserved character for XML documentation. So my […]

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 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 C#

Access Selected GridViewRow in GridView

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

Categories
ASP.NET C# JavaScript VB.NET

Inline IF’ Statement

C# string s; s = (true ? “True” : “False”); //s will be “True” VB.NET Dim s As String s = If(True, “True”, “False”) ‘s will be “True” ‘In the following you cannot rely on a particular function ‘not being called if the other argument is selected by Expression ‘(notice IIf vs. If) s = […]