I received this question from Ahmad Jadallah:
I am developing a small C# asp.net application that I will be showing inside
sharepoint server 2007 through the page viewer web part.
I want to be able to show something based on the profile of the currently logged
in user.
For example: If the city value of the currently logged in user is Paris then
show button 1, otherwise dont show it.
How can I achieve that? I tried the SharePoint webservice but I could not get it
to work.
best regards,
Dear Ahmad Jadallah
You are trying to read the user profile info in a wrong way. Remember that Page
viewer WebPart cannot and does NOT interact with the page that it opens. In
better word Page Viewer WebPart can only get the requested page and display it
on the client. It does not execute the requested page as a part of SharePoint
page and it does NOT run the requested page in the SharePoint execution context.
To have your page interact with the SharePoint context you have two ways:
Create your WebPart yourself and interact with the current user like a
normal ASP .NET user (User.Identity.Name) and then decide of displaying the
controls on the webpart.
Try creating your ASP .NET page under server layouts “C:\Program
Files\Common Files\Microsoft Shared\web server
extensions\12\TEMPLATE\LAYOUTS” and call it under http://servername/_layouts/yourpage.aspx
Regards
Alireza