Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

HttpContextSwitch Class

Performs a RewritePath. Original path will be restored on Dispose

For a list of all members of this type, see HttpContextSwitch Members .

System.Object
   HttpContextSwitch

[Visual Basic]
Public Class HttpContextSwitch
    Implements IDisposable
[C#]
public class HttpContextSwitch : IDisposable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Rewrites the current HttpContext's filepath to <directory>/currentcontext.dummy.
This affects resolving resources by calls to GetSection and MapPath
Original path is restored during Dispose.

Example

using( new HttpContextSwitch( "/path" ) )
{
    Response.Write( Request.FilePath ); // writes "/path/currentcontext.dummy" to response.
}
// Request.FilePath has been reset to original url here

Requirements

Namespace: Spring.Util

Assembly: Spring.Web (in Spring.Web.dll)

See Also

HttpContextSwitch Members | Spring.Util Namespace