33 messaggi dal 15 gennaio 2007
Trovo molto utile questo script, soprattutto per la mia applicazione web, ma sarebbe possibile avere anche la versione in VB???
3.165 messaggi dal 06 settembre 2002
Contributi | Blog
Ciao,

ti segnalo questo ottimo traduttore da C# a vb.net e viceversa:
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx

HTH
.

Nothing can be born from hartred

Stefano (SM15455) Mostarda
http://blogs.aspitalia.com/SM15455
Rome Italy
33 messaggi dal 15 gennaio 2007
Ho provato ad utilizzarlo (in effetti lo conoscevo già) e ho raggiunto questo risultato:

Public Class HttpToHttpsModule

Implements IHttpModule

Public Sub Init(ByVal context As HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.BeginRequest, AddressOf Me.context_BeginRequest
End Sub


Private Sub context_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
If Not HttpContext.Current.Request.IsSecureConnection Then
Dim pages As ProtectedPagesSection = CType(ConfigurationManager.GetSection("protectedPagesSection"), ProtectedPagesSection)
For Each elem As NameValueConfigurationElement In pages.Pages
Dim lt As System.Web.UI.WebControls.Literal = New Literal
If (String.Compare(HttpContext.Current.Request.Url.LocalPath, lt.ResolveUrl(elem.Value), StringComparison.OrdinalIgnoreCase) = 0) Then
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.ToString.Replace("http", "https"))
End If
Next
End If
End Sub

Public Sub Dispose() Implements System.Web.IHttpModule.Dispose

End Sub

End Class

Public Class ProtectedPagesSection
Inherits ConfigurationSection

<ConfigurationProperty("Pages", IsDefaultCollection:=True)> _
Public ReadOnly Property Pages() As NameValueConfigurationCollection
Get
Return CType(MyBase.Item("Pages"), NameValueConfigurationCollection)
End Get
End Property
End Class

e non ho nessun errore nella compilazione...

però in corrispondenza di questa rige nel web.config:

<add name="HttpToHttps" type="HttpToHttpsModule" />

mi ritorna questo errore:

"Impossibile caricare il tipo 'HttpToHttpsModule'."

(
P.S. ho inserito anche questa parte:

<configSections>
<section name="protectedPagesSection" type="ProtectedPagesSection" />
</configSections>

<protectedPagesSection>
<Pages>
<add name="Page1" value="~/Login.aspx" />
</Pages>
</protectedPagesSection>
)

dove sbaglio????

grazie in anticipo!

Gabriele.

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.