Passing security credentials to ASP from .net

R

Raj

Hi All
Here's my situation. I have a ASP page which requires windows authentication. The page works fine when I access it from IE and I am able to login succesfully.
Now I am writing some .NET code to access the page. I pass in some data for the form. I always get a 401 error. I am looking for some pointers/sample code that tells me how I can pass windows login credentials to my ASP page. I did try NetworkCredentials but that fails. Below Is my code

WebClient wc = new WebClient()
NameValueCollection nvc = new NameValueCollection()
nvc.Add("cmdSubmit","send")
nvc.Add("txtMsgText","Test Message")

byte[] buffer
buffer = wc.UploadValues(uri,"POST",nvc)
string streamReader
streamReader = System.Text.Encoding.Default.GetString(buffer)

Help will be appreciate

Thank

Raj
 
A

Andrea D'Onofrio [MSFT]

You can pass the credential (user name and password) in the HTTP request.
Check this article:
314404 HOWTO: Use Kerberos with the ServerXMLHTTP Component in MSXML

http://support.microsoft.com/?id=314404

HtH,
Andrea

--
This posting is provided "AS IS" with no warranties, and confers no rights.z

Raj said:
Hi All,
Here's my situation. I have a ASP page which requires windows
authentication. The page works fine when I access it from IE and I am able
to login succesfully.
Now I am writing some .NET code to access the page. I pass in some data
for the form. I always get a 401 error. I am looking for some
pointers/sample code that tells me how I can pass windows login credentials
to my ASP page. I did try NetworkCredentials but that fails. Below Is my
code.
WebClient wc = new WebClient();
NameValueCollection nvc = new NameValueCollection();
nvc.Add("cmdSubmit","send");
nvc.Add("txtMsgText","Test Message");

byte[] buffer;
buffer = wc.UploadValues(uri,"POST",nvc);
string streamReader;
streamReader = System.Text.Encoding.Default.GetString(buffer);


Help will be appreciated

Thanks

Raj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top