Automatic Transactions and ASP.NET
ASP.NET supports automatic transactions on systems running Microsoft Windows 2000 or later. By inserting a transaction directive in your ASP.NET page, you can instruct the page to participate in an existing transaction, begin a new transaction, or never participate in a transaction.
The following table lists and describes the transaction directives available in ASP.NET.
Directive | Description |
---|---|
Disabled | Indicates that the transaction context will be ignored by ASP.NET. This is the default transaction state. |
NotSupported | Indicates that the page does not run within the scope of transactions. When a request is processed, its object context is created without a transaction, regardless of whether there is a transaction active. |
Supported | Indicates that the page runs in the context of an existing transaction. If no transaction exists, the page runs without a transaction. |
Required | The page runs in the context of an existing transaction. If no transaction exists, the page starts one. |
RequiresNew | Indicates that the page requires a transaction and a new transaction is started for each request. |
You can indicate the level of transaction support on a page by placing the directive in your code. For example, you can ensure that the page activities always execute in the scope of a transaction by inserting the following directive.
<%@ Page Transaction="Required" %>
If you omit the transaction directive, transactions are disabled for the page.