0

コードビハインドにこれがあると、このエラーが発生します: if(Page.User.Identity.IsAuthenticated)

  System.NullReferenceException: Object reference not set to an instance of an object.

context.RewritePath メソッドを使用すると、このエラーが表示されます http://localhost/page.apx?id=22 --> http://localhost/hello-world/

Page.User.Identity.IsAuthenticated は、page.aspx?id=22 に移動すると True を返しますが、

  System.NullReferenceException: Object reference not set to an instance of an object.

/hello-world/ url にアクセスするとエラーが発生します。

4

1 に答える 1

0

url.Contains("List") の場合、URL を次のように書き換えます。

context.RewritePath(Utility.WebRoot + "List/Add.aspx", false);

私のリライターはそれほど複雑ではありません。

于 2009-09-28T08:01:07.653 に答える