I have two page that make use of macro create from 2 different C# user control (Let say Page A and B).
What I want to achieve is for user to click on a LinkButton on Page A and cross-page posting to Page B (using PostbackURL property of LinkButton). Is this possible with Umbraco?
I manage to create the LinkButton and logic work fine locally on my computer. But when i post the control onto server, i got the YSOD (Yellow Screen Of Death) saying
[HttpException (0x80004005): The file '/PageA' does not exist.]
Haven't try adding .aspx to url <-- Correction, just try adding .aspx and the getting the same error message. But this time, insteand of /PageA, it is /PageA.aspx couldn't be found
if (null != Page.PreviousPage) { if (true == Page.PreviousPage.IsCrossPagePostBack) { LinkButton lb = (LinkButton)Page.PreviousPage.FindControls("linkbutton1"); if (null != lb) { this.Label.Text = lb.Text; } } }
Locally on my computer, this code work flawlessly. But when I port it onto the server, Umbraco send me a YSOD right at the first if statement. This doesn't make any sense to me and I really want to find out why is that the case. I'm running Umbraco 4.5.2 (if that mean anything at all).
Surely there are other way of achieving my goal (Session, QueryString, Response.Redirect....etc), and I had tried some of them (they work). However, I do not wish to back down from this little problem until I fully understand what causing the YSOD (to me this is part of the learning process).
BTW, useDirectoryUrls is set to true in my web.config
I just try what you suggest. It work as we expect it to. I don't think I'm having any problem with the redirection on my site. What trouble me at the moment is the fact that Umbraco doesn't like me use Page.PreviousPage. It just keep on throwing me a YSOD with message say /PageA do not found.
The problem is with url rewriting and the lack of physical pages.
Page.PreviousPage is looking for a physical file (i.e. PageA.aspx) and since Umbraco doesn't have physical files and is using url rewriting, you are getting this error.
I'd recommend using a MultiView control instead since pages are dynamic
Cross page postback
Hi,
I have two page that make use of macro create from 2 different C# user control (Let say Page A and B).
What I want to achieve is for user to click on a LinkButton on Page A and cross-page posting to Page B (using PostbackURL property of LinkButton). Is this possible with Umbraco?
I manage to create the LinkButton and logic work fine locally on my computer. But when i post the control onto server, i got the YSOD (Yellow Screen Of Death) saying
Any help would be much appreciate
Are these physical pages or umbraco nodes?
Hi Daniel,
Those page are .NET user control on umbraco pages/nodes.
Regards,
Ken
Probably been checked... let me know.
Can you browse to the node/page directly?
Have you tried adding .aspx to the url.
Do you have directoryUrls enabled?
I can browse to node/page directly.
Haven't try adding .aspx to url <-- Correction, just try adding .aspx and the getting the same error message. But this time, insteand of /PageA, it is /PageA.aspx couldn't be found
DirectoryUrls is turn on
What does your code for the redirect look like? Please paste.
BTW.. useDirectoryUrls is set in web.config appsettings. (false by default)
It is a very simple redirect code
On PageA is just a LinkButton with a PostBackUrl point to PageB
On PageB, the following code in Page_Load event
Locally on my computer, this code work flawlessly. But when I port it onto the server, Umbraco send me a YSOD right at the first if statement. This doesn't make any sense to me and I really want to find out why is that the case. I'm running Umbraco 4.5.2 (if that mean anything at all).
Surely there are other way of achieving my goal (Session, QueryString, Response.Redirect....etc), and I had tried some of them (they work). However, I do not wish to back down from this little problem until I fully understand what causing the YSOD (to me this is part of the learning process).
BTW, useDirectoryUrls is set to true in my web.config
I have a colleague of mine to look at the code. He told me to put in one line of debug code (which i should have done ages ago)
This line throw me the exact same error as the above code. Does this mean it is an Umbraco bug?
Change PostBackUrl to the "/PageB/" .. (note the trailing slash)
If that doesn't help, then try "/PageB.aspx"
The urls are rewritten to exclude the the .aspx when directoryUrls is set to true... I have a feeling this might not fix things, but I need to know.
Thanks.
I entered the following directly into a template on my site and it worked fine.
Try this directly in your template where the macro is to see if it works.. this way can limit to issue to the macro or somewhere else.
<asp:LinkButton id="testbutton" PostBackUrl="/" Text="Test PostBack" runat="server"></asp:LinkButton>
Hi Daniel,
I just try what you suggest. It work as we expect it to. I don't think I'm having any problem with the redirection on my site. What trouble me at the moment is the fact that Umbraco doesn't like me use Page.PreviousPage. It just keep on throwing me a YSOD with message say /PageA do not found.
Does the code I provide above work on your site?
Thanks
Ken
I tried your code and got the same error.
The problem is with url rewriting and the lack of physical pages.
Page.PreviousPage is looking for a physical file (i.e. PageA.aspx) and since Umbraco doesn't have physical files and is using url rewriting, you are getting this error.
I'd recommend using a MultiView control instead since pages are dynamic
is working on a reply...