Friday, June 2, 2006

The LINQ Project & SQL Prompt

Microsoft has begun work on the next version of .Net. One of the key features is integrated SQL commands. T-SQL keywords and commands will now be part of intellisense, elimating spelling errors. In addition, table and field names will also be incorporated in intellisense. This project is named LINQ (Language Integrated Query). To read more about LINQ, please visit The LINQ Project.

For those that can't wait for the next release of .Net to use this feature, Red Gate Software has introduced SQL Prompt. This product provides SQL Intellisense in Microsoft Query Analyzer, SQL Server 2005 Management Studio, Visual Studio 2005, Visual Studio .NET 2003, SQL Server 2000 Enterprise Manager, and UltraEdit32. To read more about this product or to download a free version, please visit the SQL Prompt web site.

Wednesday, May 31, 2006

Detecting a user's group in SharePoint 2003

Listed below is a C# example of programmatically querying the group(s) a user belongs to on a SharePoint 2003 site:

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

private boolean IsContributor()
{
boolean bContributor = false;
SPWeb currentWeb = SPControl.GetContextWeb(this.Context);
SPRoleCollection currentRoles = currentWeb.CurrentUser.Roles;

foreach(SPRole myRole in currentRoles)
{
strRoles = myRole.Name.ToString();

if (strRoles == "Contributor")
{
bContributor = true;
break;
}
}

return bContributor;

}

"File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."

I had an windows application that was converted from Visual Basic 6.0 to VB.Net 2003. After it ran fine in development, I moved to production where I received the following error "File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."

Since the application was converted from an older version of VB and uses some legacy functions, it requires "Microsoft.VisualBasic.Compatibility.dll". This library was originally found on the development machine in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322, but was not found on the production server.

The easiest way to resolve this is simply to copy the .DLL into the working directory of the application. The .DLL can also be packaged with the project installation to avoid the same issue from repeating with future installs.

Preventing Timeout while debugging XML Web Services

When debugging XML Web Services, an exception appears indicating the operation has timed out. To resolve this problem, set the TimeOut property on the XML web service object to -1. This will set it to infinite timeout.

This tip was found in "Debugging Applications For Microsoft .Net and Microsoft Windows"

Friday, May 26, 2006

"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual"

Q: I have an ASP.Net application that when launched produces the following error:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

What can I do to resolve it?

A: This could be do to the virtual directory not being configured as an application.
To create an Application using a Virtual Directory, use the following procedure.
  1. Open the IIS Manager (inetmgr.exe)
  2. Right click on "Virtual Directory" and select "Properties".
  3. Click on the "Create" button.

The Virtual Directory is now configured as an Application and the ASP.Net should work as expected. If not there maybe a conflict with the settings in the Machine.config file.

Wednesday, May 17, 2006

Microsoft Expression Products

Microsoft has released a new product line called Expression, targeting web designers and developers. The product line up consists of 3 products:
  1. Expression Graphic Designer: used for creating vector or pixel-based rich graphics with texture and dimensions
  2. Expression Interactive Designer: for creating an engaging and interactive interface using multi-media.
  3. Expression Web Designer: used for building optimal web sites using a visual designer and leveraging ASP.Net, XML, and XHTML.
Web designers can incorporate elements from each product into a single web site. In addition, all these products can be used in conjunction with Visual Studio 2005 to leverage the capabilities of programming languages such as C# and VB.Net. Projects can then be built and deployed from Visual Studio.

For more information or to download a trial version, visit the Expression home page at http://www.microsoft.com/products/expression/en/default.mspx

Tuesday, May 16, 2006

Microsoft Expression Web Designer

Today Microsoft has released the beta version of Expression Web Designer. It is intended to replace Frontpage, which is being phased out of the product lineup.

In addition, Expression Web Designer will also offer reporting tools for web developers to help identify sites where Cascading Style Sheets are causing errors, accessibility of the site to handicapped Web users, and how many errors users of older Web browsers are encountering when viewing the site.

To download the CTP (Community Technology Preview) beta version, go to http://www.microsoft.com/products/expression/en/web_designer/wd_free_trial.aspx

Thursday, May 11, 2006

Generating a GUID

Q: How can I create a unique value without using a counter?

A: The .Net framework provides a method for generating a universally unique identifier or GUID and can be accessed as shown below:

Dim strGUID as String = System.GUID.NewGuid().ToString()

GUID is short for Globaly Unique Identifier. This number is
based on IP address, MAC address, and date/time. It's represented as a series of alpha-numeric characters in the format {8-4-4-4-12}.

Using the NewGuid() method allows unique numbers to be generated by one function call, without concern for repeating identifiers or counters.

Wednesday, May 10, 2006

C# in SQL Server 2005 Reporting Services

Q: I know that VB.Net functions are available in SQL Server 2005 RS (Reporting Services), but does it also accept C# commands?

A: The expression language for Reporting Services is VB.Net only. You can call an assembly that contains functions written in C#. This is a very valid option, but the call from within the report will be with the VB.Net syntax.

Thanks to Mike Shelton (Microsoft) for answering this question.

Tuesday, May 9, 2006

MS Certification Courses

Q: Where can I take a class that would be geared toward certification in either .NET forms or ASP.Net? I interested in exams 70-315 or 70-316.

A: Check out this link (http://www.microsoft.com/learning/mcp/mcsd/requirementsdotnet.asp). It lists the tests needed for passing the MCSD along with MS courses. You can register with these exact same course numbers at CCC or CSU Continuing Education, or any other MS certified training facility.

Also, right now MS is offering a free second shot exam if you register before end of June. For more info, see http://www.microsoft.com/learning/mcp/offers/2ndchance/.

Wednesday, April 26, 2006

Microsoft Application Verifier

Microsoft recently released v3.1 of Application Verifier. This is a runtime verification tool for unmanaged code that assists in finding subtle programming errors that can be difficult to identify with normal application testing. Run the Application Verifier tests on your code to identify issues within heaps, handles, and locks. The product is available for Windows Server 2003, Windows Vista, and Windows XP. To read more about it or to download it, go to http://www.microsoft.com/downloads/details.aspx?familyid=BD02C19C-1250-433C-8C1B-2619BD93B3A2&displaylang=en

Thursday, April 20, 2006

HTML-based Text Editor

I came across an MSDN article that describes how to build an HTML-based text editor. The final product is professional in appearence and functionality, complete with font editing, drop down list boxes and a splash screen to display a company logo. To see how this editor is created in 6 steps, go to http://msdn.microsoft.com/library/default.asp?url=/workshop/author/editing/tutorials/html_editor.asp

Tuesday, April 18, 2006

Microsoft Downloads

I found a few interesting downloads, free from Micorsoft.

User Profile Hive Cleanup Service:The User Profile Hive Cleanup service helps to ensure user sessions are completely terminated when a user logs off. System processes and applications occasionally maintain connections to registry keys in the user profile after a user logs off. In those cases the user session is prevented from completely ending. This can result in problems when using Roaming User Profiles in a server environment or when using locked profiles as implemented through the Shared Computer Toolkit for Windows XP.http://www.microsoft.com/downloads/details.aspx?familyid=1B286E6D-8912-4E18-B570-42470E2F3582&displaylang=en

Port Reporter:Port Reporter logs TCP and UDP port activity on a local Windows system. Port Reporter is a small application that runs as a service on Windows 2000, Windows XP, and Windows Server 2003. http://www.microsoft.com/downloads/details.aspx?FamilyID=69BA779B-BAE9-4243-B9D6-63E62B4BCD2E&displayLang=en

Calculator plus: http://www.microsoft.com/downloads/details.aspx?FamilyID=32B0D059-B53A-4DC9-8265-DA47F157C091&displaylang=en&Hash=RD948Y5