views:

146

answers:

1

Hello

I get this error when i have this in my codebehind: if(Page.User.Identity.IsAuthenticated)

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

This error show when i use context.RewritePath method http://localhost/page.apsx?id=22 --> http://localhost/hello-world/

Page.User.Identity.IsAuthenticated return True when i go to page.aspx?id=22 but i get

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

error when i go to /hello-world/ url.

A: 

If the url.Contains("List") then rewrite the url like this:

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

My rewriter is not more complicate then that.

Frozzare