 |
|
 |
|
|
 |
Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-21-05 12:48 PM
In my application , i have used aspx page , which is not an MCMS Template .I
n
this page I am accessing ceratin postings and their contents based on
parameters and doing certain editing .Here I am not getting authenticated CM
S
context , so I have to create a new CmsApplicationContext() object and call
AuthenticateAsUser() with UserID and Password passed as parameters .
Can I do the authentication for this non-CMS page in a better way
or is there way out to match HttppContext.Current of the non-CMS page with
CmsHttpContext.Current of the CMS-page from which this non-CMS page was
called?
Pls Help .
Thanx,
Sivaji
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-21-05 12:48 PM
Hi Sivaji,
if your pages are in a MCMS template project you could also use
CmsHttpContext. There is no need to use the CmsApplicationContext.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
news:68E7C557-1CC4-457F-B4C7-BC4E1AF03097@microsoft.com...
> In my application , i have used aspx page , which is not an MCMS Template
> .In
> this page I am accessing ceratin postings and their contents based on
> parameters and doing certain editing .Here I am not getting authenticated
> CMS
> context , so I have to create a new CmsApplicationContext() object and
> call
> AuthenticateAsUser() with UserID and Password passed as parameters .
> Can I do the authentication for this non-CMS page in a better way
> or is there way out to match HttppContext.Current of the non-CMS page with
> CmsHttpContext.Current of the CMS-page from which this non-CMS page was
> called?
> Pls Help .
> Thanx,
> Sivaji
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-21-05 12:48 PM
Hi Stefan,
Thanx for ur reply. I used CmsHttpContext.Current and it worked.But my
requirement is the modification and updation of the posting contents , for
which I was using
cmsContext.AuthenticateAsUser("user","password",PublishingMode.Update);
and it was serving my purpose .But with CmsHttpContext , it fails because it
is not in the PublishingMode.Update mode.How can I set this mode to
PublishingMode.Update?
Thanx,
Sivaji
"Stefan [MSFT]" wrote:
> Hi Sivaji,
>
> if your pages are in a MCMS template project you could also use
> CmsHttpContext. There is no need to use the CmsApplicationContext.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: [url]http://tinyurl.com/6zj44[/url
]
> ----------------------
>
>
> "Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
> news:68E7C557-1CC4-457F-B4C7-BC4E1AF03097@microsoft.com...
>
>
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-21-05 10:52 PM
Hi Sivaji,
you need to add NRMODE=Update to the querystring to achieve this.
Or you need to use application context. Using windows authentication you
could do it this way:
CmsApplicationContext cmsContext = new CmsApplicationContext();
WindowsIdentity ident = HttpContext.Current.User.Identity as
WindowsIdentity;
cmsContext.AuthenticateUsingUserHandle(ident.Token,PublishingMode.Update);
Using forms authentication you need to use AuthenticateAsUser.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
news:E6115935-EB21-4900-93BF-A2584B2F50EB@microsoft.com...[vbcol=seagreen]
> Hi Stefan,
> Thanx for ur reply. I used CmsHttpContext.Current and it worked.But my
> requirement is the modification and updation of the posting contents ,
> for
> which I was using
> cmsContext.AuthenticateAsUser("user","password",PublishingMode.Update);
> and it was serving my purpose .But with CmsHttpContext , it fails because
> it
> is not in the PublishingMode.Update mode.How can I set this mode to
> PublishingMode.Update?
> Thanx,
> Sivaji
>
> "Stefan [MSFT]" wrote:
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-22-05 07:48 AM
Hi Stefan,
Thanx for ur suggestion .I could not use NRMODE=Update becoz I am clueless
about where and how this send this query string(also my aspx page is a
non-CMS page) as this one is undocumented CMS 2002 Help file.
I tried the second option and wrote code as u suggested ,but I am getting
NullReferenceException with WindowsIdentity ident set to null.The reason
looks like the statement:
WindowsIdentity ident = HttpContext.Current.User.Identity as WindowsIdentity
;
does not help ident get any reference ,although
HttpContext.Current.User.Identity is not null.
Can u advise where I am going wrong?
Thanx,
Sivaji
"Stefan [MSFT]" wrote:
> Hi Sivaji,
>
> you need to add NRMODE=Update to the querystring to achieve this.
> Or you need to use application context. Using windows authentication you
> could do it this way:
>
> CmsApplicationContext cmsContext = new CmsApplicationContext();
> WindowsIdentity ident = HttpContext.Current.User.Identity as
> WindowsIdentity;
> cmsContext.AuthenticateUsingUserHandle(ident.Token,PublishingMode.Updat
e);
>
> Using forms authentication you need to use AuthenticateAsUser.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: [url]http://tinyurl.com/6zj44[/url
]
> ----------------------
>
>
> "Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
> news:E6115935-EB21-4900-93BF-A2584B2F50EB@microsoft.com...
>
>
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-22-05 12:49 PM
Hi Sivaji,
as indicated this will only work with windows authentication. Not with guest
and not with forms authentication.
For the query string: just call your page with NRMODE=Update on the
querystring!
http://server/yourproject/youraspxp...x?NRMODE=Update
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
news:038351C2-AB79-4BA4-B63F-70AB4C305F79@microsoft.com...[vbcol=seagreen]
> Hi Stefan,
> Thanx for ur suggestion .I could not use NRMODE=Update becoz I am clueless
> about where and how this send this query string(also my aspx page is a
> non-CMS page) as this one is undocumented CMS 2002 Help file.
> I tried the second option and wrote code as u suggested ,but I am getting
> NullReferenceException with WindowsIdentity ident set to null.The reason
> looks like the statement:
> WindowsIdentity ident = HttpContext.Current.User.Identity as
> WindowsIdentity;
> does not help ident get any reference ,although
> HttpContext.Current.User.Identity is not null.
> Can u advise where I am going wrong?
> Thanx,
> Sivaji
> "Stefan [MSFT]" wrote:
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: Authenticating CMS Context from a non-CMS page |
 |
 |
|
|
09-22-05 12:49 PM
Hi Stefan,
Thanx for ur valuable advice.It helped me get what I wanted.
Sivaji
"Stefan [MSFT]" wrote:
> Hi Sivaji,
>
> as indicated this will only work with windows authentication. Not with gue
st
> and not with forms authentication.
>
> For the query string: just call your page with NRMODE=Update on the
> querystring!
>
> http://server/yourproject/youraspxp...x?NRMODE=Update
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: [url]http://tinyurl.com/6zj44[/url
]
> ----------------------
>
>
> "Sivaji" <Sivaji@discussions.microsoft.com> wrote in message
> news:038351C2-AB79-4BA4-B63F-70AB4C305F79@microsoft.com...
>
>
>
[ Post a follow-up to this message ]
|
|
|
 |
|
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 07:27 PM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|