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



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);


PageViewerWebPart lobjWebPArt = new PageViewerWebPart();

//Change to the JSP URL or youe web Application

lobjWebPArt.ContentLink = "http://localhost:4000/loginpage1.aspx?SID="+ user.LoginName.ToString() +"&VIEW=domain";