Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Web


Namespace Platform
    Public Class PlatformUriTranslator
        Implements IHttpModule
        Public Sub Init(context As HttpApplication) Implements IHttpModule.Init
            AddHandler context.BeginRequest, New EventHandler(AddressOf context_BeginRequest)
        End Sub

        Public Sub Dispose() Implements IHttpModule.Dispose
        End Sub

        Private Sub context_BeginRequest(sender As Object, e As EventArgs)
#If SL5 Then
            Dim app As HttpApplication = DirectCast(sender, HttpApplication)
            Dim url As String = app.Request.RawUrl
            If String.IsNullOrWhiteSpace(url) OrElse url = "\" OrElse url = "/" OrElse url.StartsWith("/default.aspx", StringComparison.OrdinalIgnoreCase) Then
                app.Context.RewritePath("/Default.5.aspx")
            End If
#End If

        End Sub


    End Class

End Namespace
