1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Imports System.Web
Public Class HttpModuleRewriting
Implements IHttpModule
Dim odbConnect As New DBConnect
Private _context As HttpContext
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
_context = context.Context
AddHandler context.BeginRequest, AddressOf context_beginRequest
End Sub
Protected Sub context_beginRequest(ByVal sender As Object, ByVal args As EventArgs)
'on cast le sender en HttpAplication
'Dim Appl As System.Web.HttpApplication = DirectCast(sender, System.Web.HttpApplication)
''On initialise le moteur de réécriture
'Dim e As New Engine(Appl)
'Dim r As String = e.Process()
'If r <> "" Then
' SendToNewUrl(r, Appl)
'End If
'Obtient l 'URL a rencoder
Dim sSql, TypeTransacUrl As String
Dim Url As String = _context.Request.RawUrl
If Url.Contains("Vente") Then
odbConnect.openConnection("DB")
sSql = "SELECT transaction_id FROM transactions where descriptif = 'Vente'"
TypeTransacUrl = odbConnect.executeRead(sSql)
_context.RewritePath("Default.aspx?transac=" & TypeTransacUrl)
End If
End Sub |
Partager