A personal repository of technical notes. - CSC

KB2418241 MS10-070 Breaks Forms Authentication Ticket Sharing Between v1.1 and v2.0

Problem
Shared forms authentication between ASP.NET 1.1 and 2.0 stopped working after installing Security Update for Microsoft .NET Framework 2.0 SP2 and 3.5 SP1 on Windows Server 2003 and Windows XP x86 (KB2418241).

Received the following error in Application Event Viewer after authenticating in a v1.1 web page and then browsing to a v2.0 web page:
Event code: 4005
Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid.

Solution
As of 11/1/2010: Apply Hotfix KB2433751.

"KB2433751 - Form Authentication Ticket Compatibility Issue with MS10-070 - Home." MSDN Code Gallery - Home. Web. 01 Nov. 2010.
<http://code.msdn.microsoft.com/KB2433751>.

Note: Download NDP1.1sp1-KB2433751-X86.exe worked with Windows XP.

References
"MS10-070: Description of the Security Update for the Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 2.0 Service Pack 2 on Windows Server 2003 and on Windows XP." Microsoft Support. Web. 01 Nov. 2010.
<http://support.microsoft.com/kb/2418241>.

"FIX: Forms Authentication Cookies Compatibility Issue between .NET Framework 1.1 and .NET Framework 2.0 SP2 ASP.NET Applications after You Apply the Security Update from Security Bulletin MS10-070." Microsoft Support. Web. 01 Nov. 2010.
<http://support.microsoft.com/kb/2433751>.

"KB2433751 - Form Authentication Ticket Compatibility Issue with MS10-070 - Home." MSDN Code Gallery - Home. Web. 01 Nov. 2010.
<http://code.msdn.microsoft.com/KB2433751>.

"Legacy Encryption Mode and Microsoft .NET Framework 1.1 - ASP.NET Forums." Forums.asp.net : The Official Microsoft ASP.NET Forums. Web. 01 Nov. 2010.
<http://forums.asp.net/t/1609592.aspx>.

VS2005 Remove Add Reference Recent MRU

Problem
Need to remove obsolete items from most recently used (MRU) recent references in Visual Studio.

Solution
The entries are located at these registry locations:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ComponentPickerPages\Recent\{2483F435-673D-4FA3-8ADD-B51442F65349}
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ComponentPickerPages\Recent\{9A341D95-5A64-11D3-BFF9-00C04F990235}

References
None

Keyboard Has Stuck Key

Problem
Keyboard has a stuck key but it can not be detected manually. Need a stuck key detector utility.

Solution
Use a utility such as Microsoft Keyboard Diagnostics (MS Key). MSKEY.EXE is a utility program that is included with the Microsoft IntelliType software. It allows you to test key response on the keyboard.

References
"Troubleshoot Wired Keyboards That Don't Respond or That Type Wrong Characters." Microsoft Support. Web. 16 Aug. 2010.
<http://support.microsoft.com/kb/258826>.
"Software Download." Microsoft Corporation. Web. 16 Aug. 2010.
<http://www.microsoft.com/hardware/download/download.aspx?category=MK>.

Open TFS Output Window in Visual Studio

Problem
Can't see TFS output window in Visual Studio.

Solution
Run macro to open window.
  

Public Sub OpenTFSOutputWindowPane()

Dim window As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)

Dim outputWindow As OutputWindow = CType(window.Object, OutputWindow)

Dim tfsOutputWindowPane As OutputWindowPane = outputWindow.OutputWindowPanes.Item("Source Control - Team Foundation")

tfsOutputWindowPane.Activate()

window.Visible = True

End Sub

TFS Team Foundation Server Command Line Tips

How to get all items checked out to user
tf status /user:myusername /format:Detailed

How to get all items checked out to all users in a specific source location
tf status /user:* /recursive "$/My Folder1/My Folder2"

Variation: Pipe the results to the FIND command in order to filter the results. This example shows only items of change type "add".
tf status /user:* /recursive "$/My Folder1/My Folder2" | FIND " add "

How to undo other user's checkout.
Step 1) Get workspace and user name of checked out file.
tf status /user:* /format:detailed "$/My Folder1/My File1.txt"

Step 2) Undo checked out file.
tf undo /workspace:myworkspace;myusername "$/My Folder1/My File1.txt"

References
"Status Command." MSDN | Microsoft Development, Subscriptions, Resources, and More. Web. 16 Aug. 2010.
<http://msdn.microsoft.com/en-us/library/9s5ae285(v=VS.90).aspx>.
"Undo Command." MSDN | Microsoft Development, Subscriptions, Resources, and More. Web. 16 Aug. 2010.
<http://msdn.microsoft.com/en-us/library/c72skhw4(v=VS.90).aspx>.
"Command-Line Syntax (Team System)." MSDN | Microsoft Development, Subscriptions, Resources, and More. Web. 23 Sept. 2010.
<http://msdn.microsoft.com/en-us/library/56f7w6be(v=VS.90).aspx>.

Updates
2010-09-23 Added "Get items checked out to all users in a specific source location"; reference to "Command-Line Syntax (Team System)."
2010-09-24 Added "Variation: Pipe the results to the FIND command..."

Change GridView SortDirection Default

Problem
Need to change the default SortDirection in a GridView for certain columns from ascending to descending.

Solution
Note: This was tested and implemented in ASP.NET 2.0.
  

<asp:GridView DataSourceID="MySqlDataSource" AllowSorting="true" AutoGenerateColumns="false"

ID="MainGridView" runat="server" OnSorting="MainGridView_Sorting">

<Columns>

<asp:BoundField DataField="MyDataField01" SortExpression="MyDataField01" />

<asp:BoundField DataField="MyDataField02" SortExpression="MyDataField02" />

<asp:BoundField DataField="MyDataField03" SortExpression="MyDataField03" />

<asp:BoundField DataField="MyDataField04" SortExpression="MyDataField04" />

<asp:BoundField DataField="MyDataField05" SortExpression="MyDataField05" />

<asp:BoundField DataField="MyDataField06" SortExpression="MyDataField06" />

</Columns>

</asp:GridView>

protected void MainGridView_Sorting(object sender, GridViewSortEventArgs e)

{

// Change default sort order to Descending for certain columns.

switch (e.SortExpression)

{

case "MyDataField01":

case "MyDataField03":

case "MyDataField06":

// Current sort column is different than previous sort column

if (e.SortExpression != MainGridView.SortExpression)

{

e.SortDirection = SortDirection.Descending;

}

break;

default:

break;

}

}

Customize Context Menu of Visual Studio

Problem
Need to customize context menus (also known as shortcut menus) in Visual Studio .NET.

Solution
Note: This technique allows you to modify main menus and context menus.

Instructions tested in VS2013, VS2010 and SSMS 2012, SSMS 2014
  1. Tools/Customize.../Commands tab
  2. Click "Context menu"
  3. Select the menu to modify from the drop down menu
Instructions tested in VS2005, VS2008
  1. Tools/Customize.../Toolbars tab
  2. Check "Context Menus"
    Note: Context Menus may also be modified directly in the toolbar added on this step and the rest of the steps may be skipped.
  3. Commands tab/Rearrange Commands...
  4. Follow detailed steps in Microsoft reference titled "How to: Customize Main Menus and Shortcut Menus".
Common menus to modify
  • C# code-behind: Other Context Menus/Code Window
  • ASPX, ASCX front-end: Other Context Menus/ASPX Context
  • CSS style sheet: Other Context Menus/CSSSource
  • SQL Stored Proc: Other Context Menus | SqlEditorContextMenu
  • Solution Explorer: Project and Solution Context Menus | Item
  • Solution Explorer: Project and Solution Context Menus | Web Item
  • SSMS: File editor: Other Context Menus | SQL Files Editor Context
  • HTML, Classic ASP: Other Context Menus | HTML Context
Common commands to add
  • Edit/Collapse All Outlining
  • Macros/{Custom Macros} (Prior to VS2012)
  • Tools/{Custom Extensions}
  • File/TfsGetLatestVersion
  • File/TfsCheckOut
  • File/TfsCheckIn
  • File/TfsUndoCheckout
  • File/TfsHistory
  • File/TfsCompare
  • Tools/Customize...
Miscellaneous menus and commands
  • SQL Results Pane: Other Context Menus | SqlEditorResultsContextMenu
    • Data/Show/Hide Results Pane
Example


References
"How To: Customize Menus and Toolbars (Visual Studio)." MSDN Explore Desktop, Web, Cloud, and Phone Software Development. Web. 23 Aug. 2011.
<http://msdn.microsoft.com/en-us/library/wdee4yb6.aspx>.
"How To: Customize Main Menus and Shortcut Menus." MSDN: Microsoft Development, MSDN Subscriptions, Resources, and More. Web. 07 May 2010.
<http://msdn.microsoft.com/en-us/library/ms241445(VS.80).aspx>.

Updates
2015-05-28 Added VS2013, SSMS 2014 References
2013-09-30 Added SSMS references.
2013-02-01 Added Common commands to add. Changed example images.
2011-08-23 Added VS2010 References

Excel Tips

Create Custom Macro Workbook
  1. Create new workbook for custom macros.
  2. Save workbook in a folder with no other items.
  3. Hide workbook:
    Window/Hide
  4. Configure Custom Macro Workbook to automatically open by placing folder name in:
    Excel/Tools/Options/General/At startup, open all files in:
Dynamic Hyperlink Formula
View Web PageQuery String Value
=HYPERLINK("http://www.mydomain.com/mypage.htm?name="&B2, "View Web Page")MyValue1
=HYPERLINK("http://www.mydomain.com/mypage.htm?name="&B3, "View Web Page")MyValue2
=HYPERLINK("http://www.mydomain.com/mypage.htm?name="&B4, "View Web Page")MyValue3

Macro to Convert Text Hyperlink to Working Hyperlink

Sub HyperLinkConvert()
       ' From Microsoft: http://support.microsoft.com/kb/271856
       ' Converts each text hyperlink selected into a working hyperlink
       For Each xCell In Selection
              ActiveSheet.Hyperlinks.Add(Anchor:=xCell, Address:=xCell.Formula)
       Next xCell
End Sub

Updates
2012-10-30 Added "Macro to Convert Text Hyperlink"
2012-08-30 Added "Dynamic Hyperlink Formula"

Enable NTLM Authentication in Firefox

Problem
Need to be able to perform NTLM Authentication for Single Sign-On Integrated Authentication using Firefox browser.

Solution
Create a whitelist in Firefox settings (about:config) by adding comma delimited list of domains to network.automatic-ntlm-auth.trusted-uris

Example: myintranet, www.mydomain.com, etc

References
"Integrated Authentication - MDC." Mozilla Developer Center - MDC. Web. 23 Mar. 2010.
<https://developer.mozilla.org/En/Integrated_Authentication>.

Membership.DeleteUser() Throws REFERENCE constraint Error

Problem

Membership.DeleteUser("myMembershipUser")

Threw the following error:

The DELETE statement conflicted with the REFERENCE constraint "FK__aspnet_Me__UserI__15502E78". The conflict occurred in database "MyDatabase", table "dbo.aspnet_Membership", column 'UserId'.
The statement has been terminated.


Solution

This particular issue was resolved by adding SELECT permission to view vw_aspnet_MembershipUsers:
  

use [MyDatabase]

GO

GRANT SELECT ON [dbo].[vw_aspnet_MembershipUsers] TO [MyDatabaseUser]

GO

References

"Membership.deleteUser error - ASP.NET Forums." Forums.asp.net - Home. Web. 05 Feb. 2010.
<http://forums.asp.net/t/1254087.aspx>.

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

Problem

Error thrown when virtual folder has trailing backslash at end of Local Path setting in IIS.

Solution

Remove trailing backslash at end of Local Path setting in IIS of virtual folder.

Error message in ASP.NET v2.0
Server Error in '/MyBadVirtualFolder/MyApplicationFolder' Application.
The path '/MyBadVirtualFolder/MyApplicationFolder/App_GlobalResources/' maps to a directory outside this application, which is not supported.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Error message in ASP.NET v1.1
Server Error in '/MyBadVirtualFolder/MyApplicationFolder' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
References
brutter. "App_GlobalResources maps to a directory outside this application, which is not supported. - ASP.NET Forums." Forum. 19 Sept. 2005. Forums.asp.net - Home. Web. 22 Jan. 2010.
<http://forums.asp.net/t/889911.aspx>.

Google on SEO (Search Engine Optimization)

References

"Google's Search Engine Optimization Starter Guide" Official Google Webmaster Central Blog. 13 Nov. 2008. Web. 22 Jan. 2010. [PDF file]
<http://www.google.com/webmasters/docs/search-engine-optimization-starter-guide.pdf>.


"Google's SEO Starter Guide." Official Google Webmaster Central Blog. Web. 22 Jan. 2010.
<http://googlewebmastercentral.blogspot.com/2008/11/googles-seo-starter-guide.html>.


"Google SEO resources for beginners." Official Google Webmaster Central Blog. Web. 22 Jan. 2010.
<http://googlewebmastercentral.blogspot.com/2010/01/google-seo-resources-for-beginners.html>.