MOSS : How to pass the FBA authenticated user to a PageViewer Web Part?
If you creates a Form based authenticated site and you were not able to get the authenticated login user token at client site. You can use the following resolution when you are working with PageViwer Web Part.
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using System.Xml;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using System.ComponentModel;
namespace FBALoginUser
{
[Guid("2ea076de-3536-4d20-b5d2-365dfd098da6")]
public class FBALoginUser : System.Web.UI.WebControls.WebParts.WebPart
{
public FBALoginUser()
{
this.ExportMode = WebPartExportMode.All;
}
protected override void Render(HtmlTextWriter writer)
{
SPWeb web = SPContext.GetContext(this.Context).Web ;
web.AllowUnsafeUpdates = true;
SPUser user = web.CurrentUser;
SPWebPartCollection collection = web.GetWebPartCollection ("default.aspx", Storage.Personal);
writer.Write(user.LoginName);
PageViewerWebPart lobjWebPArt = new PageViewerWebPart();
//Change to the JSP URL or youe web Application
lobjWebPArt.ContentLink = "https://localhost:4000/loginpage1.aspx?SID="+ user.LoginName.ToString() +"&VIEW=domain";
collection.Add(lobjWebPArt);
}
}
}
Comments
- Anonymous
May 04, 2008
PingBack from http://stevepietrek.com/2008/05/04/links-542008/