ASP.net webforms oracle プロジェクトのカスタム プロファイル クラスを実装しようとしています。
これがVB.netを使用した私の基本プロファイルクラスです
Public Class BaseProfile
Inherits ProfileBase
Public Shared Function GetUserProfile(ByVal un As String) As BaseProfile
Return TryCast(Create(un), BaseProfile)
End Function
Public Shared Function GetUserProfile()
Return TryCast(Create(Membership.GetUser().UserName), BaseProfile)
End Function
Public Property PreviousPage() As String
Get
Return TryCast(MyBase.Item("previouspage"), String)
End Get
Set(value As String)
MyBase.Item("previouspage") = value
End Set
End Property
End Class
これが私がクラスを使用しようとしている方法です
If userProfile Is Nothing Then
userProfile = BaseProfile.GetUserProfile()
End If
userProfile.PreviousPage = Request.UrlReferrer.ToString()
これが私のweb.configプロファイルタグの設定方法です
<profile defaultProvider="SqlProvider" inherits="AppNamespace.BaseProfile">
<providers>
<add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="OraMembershipConnection" applicationName="AppNamespace" />
<add name="OraMembershipProvider" type="Oracle.Web.Profile.OracleProfileProvider", Oracle.Web, Culture=neutral" connectionStringName="OraMembershipConnection" ApplicationName="AppNamespace"/>
</providers>
</profile>
defaultProvider="SqlProvider" を使用すると、BaseProfile クラスを作成できますが、プロパティを設定しようとするとエラーが発生します。
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
defaultProvider="OraMembershipProvider" を使用すると、クラスの初期化でこのエラーが発生します
Provider must implement the class 'System.Web.Profile.ProfileProvider'. (C:\development\proj\web.config line 177)
私はこれに関するドキュメントをオンラインで見つけようとしました。OracleProfileProvider で BaseProfile を継承しようとすると、そのクラス内に存在しないため、Create 関数を使用できなくなります。
私が間違っていることを理解するために、これに関する指示やアドバイスが必要です! ありがとう。
はい、「OraMembershipConnection」は、プロジェクトの他の部分で機能する有効な接続です。