Technical support This forum is closed.
Version 1.x > Technical support > BUG: The resource cannot be found (on Postback) View modes: 
User avatar
Member
Member
janusz - 7/11/2005 3:34:40 PM
   
BUG: The resource cannot be found (on Postback)
OK. This took me ages to find out under which conditions this problem appears:

The error occurs when clicking on the button that causes postback

Conditions:

1/ The Button is inside the ascx control which is included in the template
2/ Template is inside some folder (not in the project root). The template is linked in CMS PageTemplates with URL like that - PageTemplates/ConsumerPageTemplate.aspx
3/ UseFriendlyURL is enabled in web.config
4/ CMSFriendlyURLStyle is dotaspx

Hopefully, you will be able to reproduce the error and find the solution soon :)

Cheers,

Janusz

User avatar
Guest
admin - 7/13/2005 1:39:38 PM
   
Re: BUG: The resource cannot be found (on Postback)
Hi Janusz,

I'm sorry for the delay. Unfortunately, we cannot reproduce this behavior.

However, it reminds me of some other issue that is connected to postbacks and URL Rewriting and that could have the same solution. Could you please try to add the following code to the page_load method of the problematic page:

RegisterStartupScript("PostBackFix", "<script>document.forms[0].action='';</script>")

Please let me know if it has any impact.

Thank you.

Best Regards,

User avatar
Member
Member
janusz - 7/13/2005 2:31:43 PM
   
Re: BUG: The resource cannot be found (on Postback)
Petr,

I have tried to add the script but with no success - nothing has changed.

I will try to describe you the exact process how to reproduce this error.

1/ Install Kentico 1.6b through the installer - VB.NET version, Sample app Mobile Store
2/ Add Everyone rights full for the created Kentico web folder in IIS
3/ Open the solution in VS.NET
4/ Change web.config to
<add key="CMSUseFriendlyURLs" value="true" />
<add key="CMSFriendlyURLStyle" value="dotaspx" />
5/ Create a new folder called Templates
6/ Copy the news.aspx and header.ascx to Templates
7/ Change the class names to News2 and Header2 (also change the reference to Header2 from News2)
8/ Create a button inside the header2 control
9/ Go to CMSDesk and add the template Templates/news2.aspx
10/ Create a new page in content tab with news2 template.
11/ Go to view mode and click on the created button - after postback it should lead to page not found
12/ If you remove CMSFriendlyURLStyle key from web.config and try again - then it works fine.


Cheers,

Janusz

User avatar
Guest
admin - 7/13/2005 3:29:02 PM
   
Re: BUG: The resource cannot be found (on Postback)
Hi Janusz,

Thank you for details. We have used the repro-steps and I'd like to confirm that we can reproduce the issue. However, we were able to fix the problem using the following code in the News2.aspx.vb file:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RegisterStartupScript("PostBackFix", "<script>document.forms[0].action='';</script>")
End Sub

After recompilation, the postback works fine.

Could you please try it on your machine as well?

Thank you.

Best Regards,

User avatar
Member
Member
janusz - 7/13/2005 3:47:45 PM
   
Re: BUG: The resource cannot be found (on Postback)
Thanks Petr. The script really solves the issue, but not completely. Normally I am viewing the site from the Content tab in CMSDesk. This script solves the problem when you are viewing the site as normal visitor would do - that is why I could not confirm that the script works. If I view the site within the CMSDesk then the error is still there. However, it is interesting that if I perform right-click on the page, hit refresh, and the click on my button that performs postback then everything is fine.

However, this is really minor issue. Important is that site works from the outside.

Thanks for your help.

Janusz

User avatar
Guest
admin - 7/13/2005 4:04:26 PM
   
Re: BUG: The resource cannot be found (on Postback)
Janusz, thanks for the info. Actually, this seems to be caused by your browser cache. Could you please try to clear the cache of your browser, restart the browser and see the page in the Site or Content section again?

Thank you.

Regards,

User avatar
Member
Member
janusz - 7/13/2005 4:12:10 PM
   
Re: BUG: The resource cannot be found (on Postback)
It really seems like a cache issue - if you do not experience the same behaviour. I have tried to clear the cache, restart browser, restart IIS but the problem is still there. It is not really important, I will leave it and maybe browser will forget about the pages in couple of days :))

Thanks,

Janusz