Posting Data From HTML to ASPX
Published: Jul 06, 2010 20:32:00
Physical Link: Posting Data From HTML to ASPX
Recently I had a need to have a web site post credentials to another web site. The first site was standard HTML and the second site was DotNet (ASP.NET).
In this example, we will be passing a user name and password to another site.
Sending Web Site
In your sending website, you will need a log in panel similar to the one below.
Receiving Web Site
In the form load of your DotNet (ASP.NET) site, you will need the following code to get the values from the request object and then pass to your log in routine.
NameValueCollection nvc = Request.Form;
string userName = "";
string password = "";
if (!string.IsNullOrEmpty(nvc["txtUserName"]))
{
userName = nvc["txtUserName"];
}
if (!string.IsNullOrEmpty(nvc["txtPassword"]))
{
password = nvc["txtPassword"];
}
ExecuteLogin(userName, password);
The post Posting Data From HTML to ASPX appeared first on LDNDeveloper.
Author: Andrew PallantCategories: ASP, C#, C-Sharp, Developement, How To, Web, asp.net, development, HTML