ViewStateException.Referer ViewStateException.Referer ViewStateException.Referer ViewStateException.Referer Property


ビューステート例外が発生したページにリンクしているページの URL を取得します。Gets the URL of the page that linked to the page where the view-state exception occurred.

 property System::String ^ Referer { System::String ^ get(); };
public string Referer { get; }
member this.Referer : string
Public ReadOnly Property Referer As String


HTTP 参照元を格納している StringA String containing the HTTP referrer.

次のコード例は、base64 でエンコードされた文字列を逆シリアル化して返すメソッドを実装する方法を示します、ICollectionプロパティの設定のコレクション。The following code example demonstrates how to implement a method that deserializes a base64-encoded string and returns an ICollection collection of property settings. Deserializeメソッド、HttpException例外を含む、ViewStateException内部例外としてのオブジェクト。The Deserialize method can throw an HttpException exception that contains a ViewStateException object as an inner exception. キャッチする方法の例を示します、HttpException例外からプロパティを取得し、ViewStateExceptionオブジェクト。The example shows how you can catch an HttpException exception and retrieve the properties from the ViewStateException object.

private ICollection LoadControlProperties(string serializedProperties)

    ICollection controlProperties = null;

    // Create an ObjectStateFormatter to deserialize the properties.
    ObjectStateFormatter formatter = new ObjectStateFormatter();

        // Call the Deserialize method.
        controlProperties = (ArrayList)formatter.Deserialize(serializedProperties);
    catch (HttpException e)
        ViewStateException vse = (ViewStateException)e.InnerException;
        String logMessage;

        logMessage = "ViewStateException. Path: " + vse.Path + Environment.NewLine;
        logMessage += "PersistedState: " + vse.PersistedState + Environment.NewLine;
        logMessage += "Referer: " + vse.Referer + Environment.NewLine;
        logMessage += "UserAgent: " + vse.UserAgent + Environment.NewLine;


        if (vse.IsConnected)
            throw e;
    return controlProperties;
Private Function LoadControlProperties(ByVal serializedProperties As String) As ICollection

    Dim controlProperties As ICollection = Nothing

    ' Create an ObjectStateFormatter to deserialize the properties.
    Dim formatter As New ObjectStateFormatter()

        ' Call the Deserialize method.
        controlProperties = CType(formatter.Deserialize(serializedProperties), ArrayList)
    Catch e As HttpException
        Dim vse As ViewStateException
        Dim logMessage As String

        vse = e.InnerException

        logMessage = "ViewStateException. Path: " + vse.Path + Environment.NewLine
        logMessage += "PersistedState: " + vse.PersistedState + Environment.NewLine
        logMessage += "Referer: " + vse.Referer + Environment.NewLine
        logMessage += "UserAgent: " + vse.UserAgent + Environment.NewLine


        If (vse.IsConnected) Then
            Throw e
        End If
    End Try
    Return controlProperties
End Function 'LoadControlProperties   


このプロパティには、同じ値が返されます、HTTP_REFERER変数、ServerVariablesプロパティ。This property returns the same value as the HTTP_REFERER variable in the ServerVariables property. 値が空の文字列 ("") のページにリンクされた前回の要求がない場合。The value is an empty string ("") if no previous request linked to the page.