This lesson will show how to create a web form that when submitted will automatically create a new lead in MSCRM v3. Please note that utilizing a web form on a public site to provide access to MSCRM might require additional licensing. Please be sure to verify you have the correct licensing for any planned deployments!
The lab uses VS 2005 and assumes you are using a development machine and then transferring the files to the CRM server. You can also use VS 2003 for this example and would just skip steps
1. Create a new directory wherever you store your custom web applications. Because I am on a VPC dev image, I just use C:\Inetpub\wwwroot\, so for this project I created a directory "weblead"

2. Open VS.NET and select File->New->Web Site. Choose ASP.NET web site and then a descriptive name, and choose "Visual C#" as the language.

3. Choose OK to create your project. This will create a directory in <my
documents>\Visual Studio 2005\WebSites

4. Right-Click on the project in Solution Explorer and select "Add Web Reference"

5. Enter
http://<yourservername>/mscrmservices/2006/crmservice.asmx.
You can accept the default name or change it, it's up to you. Click "Add
Reference"

6. Open the Default.aspx form in the designer window and add labels, fields, and a button until you have a similar form to the one shown below. Please note your form does not have to match this one exactly, the code will work even if you just use the name fields so feel free to add as many of these fields (or any other fields relating to the Lead schema) as you wish. You eill need a button of some kind though! Please note the big text box is a debug message window.

7. Double-click on the button and add the following code:
try8. Build the project and then copy the project files to the directory we created in step 1.
9. Now we need to create an IIS virtual directory for our project. Open IIS manager, right-click on the default web site, and slect New->Virtual Directory
10. Click Next

11. type an alias and click Next

12. Click the "Browse" button and browse to the directory we created in Step 1.

13. Click Next

14. Select the checkboxes as shown and click Next.

15. Click Finish

16. If using VS 2005, the project we built will be using ASP.NET 2.0. Since MSCRM runs in ASP.NET 1.1, we need to make some changes. We also need to install eiterh VS 2005 or the ASP.NET v2.0 run-time on the CRM server.
If you used VS 2003 to build the project you do not need to perform these steps.
In IIS, right-click on the header "Application Pools" and Select New->Application Pool

17. Give your new AppPool a name and click OK.


18.Next expand Web Sites->Default Web Site and select the virtual directory. Right-click and select Properties

19. On the Virtual Directory Tab select the "Application Pool" dropdown and select the new v2.0 app pool you just created.

20. Next click the "ASP.NET" tab and in the "ASP.NET version" drop-down select 2.0.50727 and then click OK.

And that's it.
So now to test our project. Open a browser and type: http://<yourserver>/<your project iis alias>. So for example, I would type http://sbsserver/weblead

Fill in some or all of of the fields and click your submit button. Next open up MSCRM and check your leads to see if the new lead is there. You might have to select "All Leads" from the view menu and/or refresh the page to see the new lead.

