Microsoft Content Management Server - template switching form post

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > November 2004 > template switching form post





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author template switching form post
Steven

2004-11-23, 5:57 pm

Hi,

I'm creating a site that can show all postings with or
without layout (for blind surfers). To make the
maintenance of the site straightforward, the authors only
work in the 'layout-version'. Each template (with layout)
has one connected template(without layout,css,...).
The content of each posting is shown on the normal
template or on the connected template depending on the
user preference (cookie).

I use template-switching in the Page_Load event of the
layout template:
//code fragment of the layout-template:
if (blindCookie != null && blindCookie.Value == "True")
{
//switch to corresponding blind template
Template te = cc.Posting.Template.ConnectedTemplates[0];

string strAlternateUrl = te.SourceFile + "?POSTINGGUID=" +
cc.Posting.Guid;

System.IO.StringWriter swrTarget = new
System.IO.StringWriter();
Server.Execute(strAlternateUrl, swrTarget);
Response.Write(swrTarget.ToString());
Response.End();
}

All works fine until I try to use a form post: this only
works on the original template. When I post data from a
posting that is shown with the connected(blind)template,

this error occurs:
This operation requires the context of a Posting. The
request must have a valid Posting Url or QueryString so
that the CmsHttpContext.Posting will not be null.
-InitializeComponent();
-base.OnInit(e); (this line generates the error)

I understand that a posting does not exist (it's the
connected template that shows the content of the original
posting), but I do not know how to tell asp.net to post
the data to the original posting.

I hope you understand this and can help me?
Steven

PS (technique for template switching explained in
document 'Supporting Mobile Devices with Microsoft Content
Management Server 2002' msdn-site)
Stefan [MSFT]

2004-11-24, 7:52 am

Hi Steven,

you need to ensure that the NRNODEGUID query string parameter is included in
the POST request.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Steven" <anonymous@discussions.microsoft.com> wrote in message
news:94fa01c4d171$b847f650$a301280a@phx.gbl...
> Hi,
>
> I'm creating a site that can show all postings with or
> without layout (for blind surfers). To make the
> maintenance of the site straightforward, the authors only
> work in the 'layout-version'. Each template (with layout)
> has one connected template(without layout,css,...).
> The content of each posting is shown on the normal
> template or on the connected template depending on the
> user preference (cookie).
>
> I use template-switching in the Page_Load event of the
> layout template:
> //code fragment of the layout-template:
> if (blindCookie != null && blindCookie.Value == "True")
> {
> //switch to corresponding blind template
> Template te = cc.Posting.Template.ConnectedTemplates[0];
>
> string strAlternateUrl = te.SourceFile + "?POSTINGGUID=" +
> cc.Posting.Guid;
>
> System.IO.StringWriter swrTarget = new
> System.IO.StringWriter();
> Server.Execute(strAlternateUrl, swrTarget);
> Response.Write(swrTarget.ToString());
> Response.End();
> }
>
> All works fine until I try to use a form post: this only
> works on the original template. When I post data from a
> posting that is shown with the connected(blind)template,
>
> this error occurs:
> This operation requires the context of a Posting. The
> request must have a valid Posting Url or QueryString so
> that the CmsHttpContext.Posting will not be null.
> -InitializeComponent();
> -base.OnInit(e); (this line generates the error)
>
> I understand that a posting does not exist (it's the
> connected template that shows the content of the original
> posting), but I do not know how to tell asp.net to post
> the data to the original posting.
>
> I hope you understand this and can help me?
> Steven
>
> PS (technique for template switching explained in
> document 'Supporting Mobile Devices with Microsoft Content
> Management Server 2002' msdn-site)



Steven

2004-11-24, 7:52 am

You're incredible.
POSTINGGUID changed in NRNODEGUID , everything runs
perfect now

Thx

>-----Original Message-----
>Hi Steven,
>
>you need to ensure that the NRNODEGUID query string

parameter is included in
>the POST request.
>
>Cheers,
>Stefan.
>
>--
>This posting is provided "AS IS" with no warranties, and

confers no rights.
>
>MCMS FAQ:
>http://download.microsoft.com/download/4/2/5/4250f79a-

c3a1-4003-9272-2404e92bb76a/MCMS+2002+-+(complete)+FAQ.htm
>MCMS Blog:

http://blogs.msdn.com/stefan_gossner/category/4983.aspx
>MCMS Sample Code:
>http://www.gotdotnet.com/community/...les/Default.asp

x? ProductDropDownList=Content+Management+S
erver
>MCMS Whitepapers and other docs:
>http://blogs.msdn.com/stefan_gossne...e/2003/12/07/41

859.aspx
>--------------------------------
>
>
>"Steven" <anonymous@discussions.microsoft.com> wrote in

message
>news:94fa01c4d171$b847f650$a301280a@phx.gbl...
only[vbcol=seagreen]
layout)[vbcol=seagreen]
POSTINGGUID=" +[vbcol=seagreen]
original[vbcol=seagreen]
Content[vbcol=seagreen]
>
>
>.
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com