walerhola 0 Newbie Poster

Basically I am writing code that is taking input from the user and then writing it to a sharepoint list. The problem is credentials of the server are obtained NOT the end user, to do this I need to impersonate the end user and then give the proper credentials to my list. I am unsure how to do this but here is my code. Any help would be appreciated. Thanks

FinanceList.Lists myList= new FinanceList.Lists();

//i need to impersonate the credentials of the user and give them to my list here, but how?
            myList.Credentials = System.Net.CredentialCache.DefaultCredentials;


            myList.Url = "https://qqqqqq.org/wwwww/eeeeee/_vti_bin/lists.asmx";
            XmlDocument doc = new XmlDocument();
            XmlElement batch = doc.CreateElement("Batch");

            batch.SetAttribute("OnError", "Continue");
            batch.SetAttribute("ListVersion", "1");
            batch.SetAttribute("ViewName", "{myID1}");

            //Information to add to list    
                batch.InnerXml = "<Method ID='1' Cmd='New'>" +
                       "<Field Name='Title'>" + invoiceNum + "</Field>" + 
                       "<Field Name='Reason'>" + reason + "</Field>" +             
                       "</Method>";

                XmlNode ndReturn = myList.UpdateListItems("{myID2}", batch);