Wednesday, June 14, 2006
Web Part Debugging Tip
This will list all web parts on that page, including their title, type, display on page, and personalized properties. This will help identify if other web parts on the page are causing problems with opening the page.
Friday, June 9, 2006
File Access in VB.Net
Sub FilePurge()
Static dtLastPurgeTime As DateTime
Dim dtNow As DateTime
Dim intCounter As Integer
Dim Files() As String
Dim strGUID As String, strTXTName As String
While True
strGUID = System.Guid.NewGuid.ToString
strTXTName = "C:\Temp\STB_" & strGUID & ".TXT"
'Create a uniquely named .TXT file
Dim swTXT As StreamWriter
swTXT = File.AppendText(strTXTName)
swTXT.WriteLine(strGUID)
swTXT.Close()
'Wait 2 seconds before proceeding
System.Threading.Thread.Sleep(2000)
dtNow = Now
Dim lTimeDiff As Long = DateDiff(DateInterval.Hour, dtLastPurgeTime, dtNow)
If lTimeDiff > 24 And Now.Hour = 22 Then 'Check if last purge was more then 24 hours ago and current hour is 10PM
'Purge *.TXT files
Files = Directory.GetFiles("C:\Temp", "STB_*.TXT")
For intCounter = Files.GetLowerBound(0) To Files.GetUpperBound(0)
If DateDiff(DateInterval.Minute, File.GetCreationTime(Files(intCounter)), dtNow) > 30 Then 'Purge only if file is older than 30 minutes
File.Delete(Files(intCounter))
End If
Next intCounter
'Update Purge Time
dtLastPurgeTime = Now()
End If
End While
Error_Handler:
Resume Next 'If an error occured while deleting a file, skip it this iteration and move to the next file
End Sub
Tuesday, June 6, 2006
Upcoming .Net related events
- June 8th: ONSQL SIG Meeting
- June 10th: GCPCUG General Meeting
- June 22nd: MSDN Event
- June 27th: C#/VB.Net SIG
Friday, June 2, 2006
The LINQ Project & SQL Prompt
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
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."
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
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"
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.
- Open the IIS Manager (inetmgr.exe)
- Right click on "Virtual Directory" and select "Properties".
- 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
- Expression Graphic Designer: used for creating vector or pixel-based rich graphics with texture and dimensions
- Expression Interactive Designer: for creating an engaging and interactive interface using multi-media.
- Expression Web Designer: used for building optimal web sites using a visual designer and leveraging ASP.Net, XML, and XHTML.
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
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
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
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
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/.