I am inheriting a sitecore implementation and I have been trying to debug a membership form. The membership page contains a membership sublayout that contains a simple form (first, last, address,…). When I am debugging on my local machine, I fill the form and click submit. The page posts back and as soon as the base layout is hit, the Sitecore.Context.Item is NULL.
The interesting part is that if I PREVIEW the page within Sitecore, when I postback everything works fine, which makes me believe that it’s just a matter of some internal settings in my web.config or some other configuration file.
Here are the content of some variables on the first hit of the page and on the postback in both PREVIEW mode and regular mode:
first hit (preview mode)
Sitecore.Context
.Data.RawUrl = /?sc_itemid=%7b2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB%7d&sc_mode=preview&sc_lang=en
.Database = master
.Item,Database = master
.Item.Id = {2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB}
.Item.Name = Website_Membership
.RawUrl = /?sc_itemid=%7b2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB%7d&sc_mode=preview&sc_lang=en
.Request.ItemPath = /sitecore/content/home/
Postback (preview mode)
Sitecore.Context
.Data.RawUrl = /Sites/CMS/Layouts/Membership Layout.aspx?sc_itemid=%7b2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB%7d&sc_mode=preview&sc_lang=en
.Database = master
.Item,Database = master
.Item.Id = {2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB}
.Item.Name = Website_Membership
.RawUrl = /Sites/CMS/Layouts/Membership Layout.aspx?sc_itemid=%7b2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB%7d&sc_mode=preview&sc_lang=en
.Request.ItemPath = /sitecore/content/home/sites/cms/layouts/membership layout
first hit (regular mode)
Sitecore.Context
.Data.RawUrl = /SomePath/Website_Membership.aspx
.Database = web
.Item,Database = web
.Item.Id = {2A58FFA4-D16A-4EAB-8298-9398ACFDDEFB}
.Item.Name = Website_Membership
.RawUrl = /SomePath/Website_Membership.aspx
.Request.ItemPath = /sitecore/content/home/somePath/website_membership
postback (regular mode)
Sitecore.Context
.Data.RawUrl = /Sites/CMS/Layouts/Membership Layout.aspx
.Database = web
.Item = NULL
.RawUrl = /Sites/CMS/Layouts/Membership Layout.aspx
.Request.ItemPath = /sitecore/content/home/sites/cms/layouts/membership layout
Has anyone experienced something like this before and/or can you think of any reason for this to happen?
EDIT:
On the sdn.sitecore forum Kevin Buckley:
I’m thinking the control adapter
‘form.browser’ is missing. It should
be in the app_browsers folder.
I just want to add a note in regards. The files were missing from the app_browsers folder BUT I had added them manually few days ago by copying them from a clean sitecore installation. That didn’t seem to help.
I had the same problem today with Sitecore.Context.Item == null after postback, after upgrading to the latest Sitecore 6.5 rev 111123
And it turned out the problem started to appear because App_Browsers\Form.browser file was removed during upgrade.
When I restored it back this issue disappeared.
Hope this will be helpful.