Enter your search criteria:
Select a Tips-and-Tricks Category:
Note: Some tips might become
outdated as new versions of the associated products are released.
Debugging the OnStart method of a Windows Service
A seldomly used trick can help you debug the OnStart method of a Windows service.
Implement PayPal's Instant Payment Notification IPN with .NET
Learn how to implement PayPal's IPN using ASP.NET. PayPal IPN is a payment processing service that
allows sellers to integrate their back-end operations with PayPal.
Use the ToolboxBitmapAttribute for custom bitmaps
Use ToolboxBitmapAttribute to specify a bitmap for a control.
When you design the bitmap, make sure it is 16 X 16 pixels. The perimeter of the bitmap
is used as a mask, so make sure it is the same color all the way around.
How the RefreshPropertiesAttribute works
Use RefreshPropertiesAttribute to indicate how a control's designer
refreshes when properties are changed. Some databound controls, such as the PropertyGrid, also
use this attribute when updating property values.
Serialize properties correctly with DesignerSerializationVisibilityAttribute
DesignerSerializationVisibilityAttribute specifies what part of a property
is serialized by the designer. (i.e. Value or Value-Length)
Persist properties correctly with PersistenceModeAttribute
PersistenceModeAttribute specifies how a property is persisted in XML.
(i.e. <MyControl MyProperty="PropertyValue"/> or <MyControl><MyProperty>PropertyValue</MyProperty></MyControl>
Make properties expandable in the Property Grid with ExpandableObjectConverter
Use the ExpandableObjectConverter type converter on a property to make it expandable in the PropertyGrid.
This is the only real use for this converter, so for any specialized code, you should derive a converter from this one.
Learn how Visual Studio implements intellisense for Web Forms
The asp.xsd schema is used to generate intellisense for web controls.
This file is normally located at \Program Files\Microsoft Visual Studio .NET\Common7\Packages\schemas\xml .
Add custom web services directories to Visual Studio
It is possible to add default web services directories to the IDE. You may do so through
\Program Files\Microsoft Visual Studio .NET\Common7\Packages\1033\HelpWatermark.htm .
Generate TemplateColumns at runtime? Don't think so.
There is no way to add a TemplateColumn to a DataGrid at runtime. This can only be done by
implementation through the designer.
Understand how permission requests work
Permission requests explicitly identify what an assembly must have, should have, or must not have to run. Make sure you
request permissions correctly, or you might unknowingly create security holes in your applications.
Implement a custom membership condition
The .NET Framwork provides a default collection of membership conditions that are used by the code access security policy.
You can also implement your own membership conditions that look for whatever evidence you desire.
Customize Visual Studio .NET's start page
If you're an XML/JScript pro, it's possible to customize the Visual Studio .NET Start Page.
Check out \Program Files\Microsoft Visual Studio .NET\Common7\IDE\HTML\StartPageTabs .
Secure code is one of -- if not the most -- important goals that software developers face today. These best practices
should be able to help you in your everyday development.
ASP.NET Custom Errors Do Not Work Correctly with ISA Web Publishing
The Custom Errors in ASP.NET is a great feature, but there is one problem of which you should be aware
when using Microsoft ISA Server's Web Publishing rules on the Web server.
Change the account that ASP.NET runs under
To change the security account that ASP.NET runs under, look at the <processModel> section of
the machine.cfg file. This may be necessary if you experience problems running or debugging ASP.NET applications.
Rebind projects to source control correctly
When re-adding a project or solution to source control that was previously added, use
File->Source Control->Change Source Control->Bind. Rebind all projects, not the solution.
Re-add the solution from Solution Explorer. The project files must still exist in Source Control.
How to Debug your ASP.NET applications
If you do not have permissions to debug ASP.NET pages, there are a number of things to do which may solve your problem.
Make custom components invisible in the designer with DesignTimeVisibleAttribute
Use DesignTimeVisibleAttribute to determine whether components get displayed in the ComponentTray. The
ComponentTray is the footer area of a typical designer, such as where Menu and DataAdapter components will be placed.
Learn how the Controls collection and the DockStyle of a control are related
Use the DockStyle property of a control to specify how a control is positioned relative to its parent. But the Controls property
of a control determines the appropriate behavior of this functionality.
Modify properties and undo changes at design time with DesignerTransaction
Use the DesignerTransaction class to modify properties and undo property changes at design-time. It is responsible for commits, undo and redo.
Add a custom folder to the Look In section of the Open and Save dialog boxes
Use Microsoft Office to customize the My Places section of Visual Studio .NET's Open and Save dialog boxes. This allows you to quickly open projects
from folders other than History, My Projects, Desktop, Favorites, and My Network Places.
Wrap the Data Protection API
The Data Protection Application Programming Interface (DPAPI) is an unmanaged implementation that provides secure data storage.
You can use platform invocation (P/Invoke) to expose this API to your managed classes.
How to Configure URL Authorization
URL Authorization protects ASP.NET resources when access control lists (ACLs) are not sufficient. Learn how to configure URL authorization correctly.