try
{
SPSite tempSite = new SPSite(siteURL);
string loginNameInFull = @"i:0#.w|" + username;
SPUserToken userToken =
tempSite.OpenWeb().AllUsers[loginNameInFull].UserToken;
using (SPSite site = new
SPSite(siteURL, userToken))
{
using (SPWeb web = site.OpenWeb())
{
SPList
olist = web.Lists[listName];
SPListItemCollection ocol = olist.Items;
return ocol;
}
}
}
This is passing credentials to Windows Authentication
UserName append with "i:0#w|"