+ Start a Discussion
todw17todw17 

Just starting with ASP.net & Salesforce

Hi -

I am just getting started with ASP.net and Salesforce.  I am trying to convert the vb quickstart example to an asp.net website, but  I am having a lot of trouble with this.  I have experience with ASP/sql programming, but I am new to ASP.net, so this is a rather daunting experiment for me.  

My end goal is to have a web application for generating custom reports online through salesforce.  I am currently doing this by reading out of tables created through an old xml-rpc client written by someone else in my organization.  This is limited because the reports are only as up to date as the tables that are stored locally.     

Has anyone been able to convert this to ASP.net?  Are there any examples of a login or anything like that out there?  Any help or pointers would be greatly appreciated.  I know that the vb.net example should be good enough, but I am interested in a web application and not a console application. 

If I could get to the point where I could use the classes in an .aspx file I think I would be fine from there.  I'm not sure I was specific enough with my question, but I think thats as good as its going to get for now.

Thanks in advance.

DevAngelDevAngel

Hi todw17,

Here a simple sample.  This is my first aspx app, so be kind.

Rename the file to .zip.

Dont forget to add a web reference and name it sforce.

 

SasiSasi

Could you tell me how I could reference the web service?

I unzipped the aspx files and added them to a project. Put login.aspx as the startpage and when I try to run (F5), I get the following error msg -

c:\inetpub\wwwroot\WebApplication11\Contacts.aspx.cs(21): The type or namespace name 'sforce' could not be found (are you missing a using directive or an assembly reference?)

DevAngelDevAngel

Hi Sashi,

Download the wsdl from the website.  This is in the Setup area under Sforce Application Server/Sforce WSDL Generator.  Save it on your computer.

In Visual Studio, from the Project menu select Add Web Reference.  Enter the path to the saved wsdl file into the URL field.  Change the Web reference name field to sforce and click the Add Reference button.

If you are using VB.net, modify the attributes of the SObject method in Reference.vb so that the following 2 lines are changed to be:

System.Xml.Serialization.XmlIncludeAttribute(GetType([Event])), _

System.Xml.Serialization.XmlIncludeAttribute(GetType([Case])), _

 

 

SasiSasi
Thanks a lot, Dave..It works...Sasi
fifedogfifedog

DevAngel,

As with Sashi I'm getting this same error but I'm using c#.  Are you aware of anychanges needed for c#?

 

Fifedog

DevAngelDevAngel

Hi fifedog,

You should get no errors in C# directly after adding the web reference.  Could you tell me exactly the error that is being raised?

hfeisthfeist

Just stumbled on this thread which is exactly what I've been having trouble with. Using C# after creating the Web Reference and naming it sforce I get this error when I compile:

 

The type or namespace name 'sforce' could not be found (are you missing a using directive or an assembly reference?)

Did someone solve this here? If so I'd be grateful to hear the solution...

 

DevAngelDevAngel

You may need to rename your web reference class to sforce.