Post form data to 3rd party URL in Asp.Net

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can send form data to a 3rd party URL in Asp.Net.

Also you can check my previous posts on asp.net mvc 4 tutorial, Generics tutorial in C#.Net and Tutorial on Cookies in asp.net.

There will be certain situations where you will not prefer to send data through query string to a 3rd party URL. In that we can use the post method to send data to the 3rd party URL.

For this we have to write a JavaScript method as well as we need to put input variables inside the form tag. Follow the below code:

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Post form data to 3rd party URL in Asp.Net</title>
<script language=”javascript” type=”text/javascript”>
function postvaluesTraining() {
document.forms[0].action = ‘http://UR 3rd Party URL/welcome.aspx’;
document.forms[0].submit();
return true;
}
</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<input type=”hidden” name=”Name” value=”aspdotnethelp” />
<input type=”hidden” name=”siteURL” value=”www.aspdotnethelp.com” />
<input type=”hidden” name=”email” value=”aspdotnethelp24@gmail.com” />
</div>
</div>
</form>
</body>
</html>

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply