I'm stuck on my project. I have Web Forms published in IIS that are shown in SharePoint 2010 site.
From that Web Form, I want to show the current user in SharePoint.
My solution is from [http://www.sharepointdeveloperhq.com/2009/04/how-to-programmatically-impersonate-users-in-sharepoint/] but it is not working for me.
I tried changing the target framework to framework 3.5 and tried changing platform to x64bit.
But it is still not working and is showing a lot of errors. My current code:
using Microsoft.SharePoint; string username; string sspURL = @"Sharepoint URL"; SPSite site = new SPSite(sspURL); SPWeb web = site.OpenWeb(); SPUser user = web.CurrentUser; username = user.LoginName; site.AllowUnsafeUpdates = true;
Error: The Web application at "my url" could not be found.
What am i doing wrong?
note: visual studio is running in the same server where sharepoint is installed with user administrator