- Visual Web Developer Express Edition
- Salesforce Developer Account
- WSDL generated by the salesforce account (http://www.salesforce.com/us/developer/docs/api_meta/index.htm)
- in VWD create a website, not a web project (this si a personal preference)
- Website -> Add Web Reference -> URL = your Enterprise.wsdl
- web reference name = "salesforce"
- Add Reference
- in your App_Code folder create a class called sfconnector.cs
{
salesforce.SforceService binding = new salesforce.SforceService();
try
{
salesforce.LoginResult lr = binding.login(sforceUsername, sforcePassword);
binding.SessionHeaderValue = new salesforce.SessionHeader();
binding.SessionHeaderValue.sessionId = lr.sessionId;
binding.Url = lr.serverUrl;
binding.Url = lr.serverUrl;
}
catch (Exception)
{ }
return binding;
}
this will connect you to salesforce provided you have the correct username and password. If we can log in we probably want to log out as well.
public void logOut(Page pg)
{
pg.Session.Abandon();
pg.Response.Write("");
}
By calling this function we'll terminate the current session.
No comments:
Post a Comment