ASP forms on websites

Sometimes we get questions from users about why it’s they can’t post a form on their website, usually it’s because their website is built in ASP-forms. The form can therefore not be pasted directly on the website as it usually because the whole page itself is designed as a form (you can’t place a form in a form).

A way to solve this issue is by posting it in the background by adding the following code:

System.Net.ServicePointManager.Expect100Continue = False
Dim postData As New NameValueCollection()
postData.Add(”email”, ”mailadress”)
postData.Add(”newsletter”, ”newsletterkey”)
postData.Add(”api_key”, ”apikey”)
postData.Add(”next_url”, ”nexturl”)
Dim wc As New WebClient
Dim rsp = wc.UploadValues(”http://admin.getanewsletter.com/api/subscription/add/”, postData)

The code is written in ASP.NET VB 3.5.