D
Denise
I am developing a web application in ASP.Net for a client using C#. One of
my tasks is to create a link from our site to an external website.
Currently, this external site has a login page with username and password
fields.
I have a cross-reference table of user names and passwords that can be used
to log the user in to this site from our ASP.Net site. We want this process
to be seemless to the user - to enter his username and password into the
login page without the user even seeing the page. The external site is NOT
ASP.
Is this possible and does anyone have some direction as to how? I have done
some searching and have some created some code, but I keep getting errros
like
Unauthorized or Method Not Allowed.
Since I have never attempted this, I have no idea if the code below is
correct, but it was my first attempt:
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("https://xyz.net//HostedSites/index.php");
request.Method = "POST";
string body = "?userName=abc&userPwd=pass1;
byte[] bytes = Encoding.ASCII.GetBytes(body);
request.ContentLength = bytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Thanks,
Denise
my tasks is to create a link from our site to an external website.
Currently, this external site has a login page with username and password
fields.
I have a cross-reference table of user names and passwords that can be used
to log the user in to this site from our ASP.Net site. We want this process
to be seemless to the user - to enter his username and password into the
login page without the user even seeing the page. The external site is NOT
ASP.
Is this possible and does anyone have some direction as to how? I have done
some searching and have some created some code, but I keep getting errros
like
Unauthorized or Method Not Allowed.
Since I have never attempted this, I have no idea if the code below is
correct, but it was my first attempt:
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("https://xyz.net//HostedSites/index.php");
request.Method = "POST";
string body = "?userName=abc&userPwd=pass1;
byte[] bytes = Encoding.ASCII.GetBytes(body);
request.ContentLength = bytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Thanks,
Denise