HttpWebRequest Window Credential
-
Hi, I am trying to send a HttpWebRequest that requires user's window login (ie, username & password) as its credential. I've made sure my website has property 'anonymous access' unchecked and 'Integrated Windows authentication' checked. In my web.config I also have "impersonate="true" " and . However, when I try to use System.Net.CredentialCache.DefaultCredentials, I get an unauthorised error. But if I manually create a crednetial with my window login everything works fine. By using WindowsPrincipal.Identity.Name, I realised the username is 'ASPNET' instead of my username. Does anyone know what I am doing wrong? Thank you. Annzy
-
Hi, I am trying to send a HttpWebRequest that requires user's window login (ie, username & password) as its credential. I've made sure my website has property 'anonymous access' unchecked and 'Integrated Windows authentication' checked. In my web.config I also have "impersonate="true" " and . However, when I try to use System.Net.CredentialCache.DefaultCredentials, I get an unauthorised error. But if I manually create a crednetial with my window login everything works fine. By using WindowsPrincipal.Identity.Name, I realised the username is 'ASPNET' instead of my username. Does anyone know what I am doing wrong? Thank you. Annzy
hi, Your ASP.NET application runs with a default user name and password which are : user name : machine password : Autogenerate now these stuffs are present in machine.config file which you can find at "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\" folder. In this file you will find a tag named "processModel". Two of the attributes of this tag are "userName" and "password". Now whenever the user name is "machine" the ASP.NET runs with the low priviledged account ASPNET. To change this, you need to specify your windows username and password in machine.config and then try to run your application. I'm not sure but you might need to restart IIS... Hopefully this will solve your problem. regards, Aryadip. Cheers !! and have a Funky day !!
-
hi, Your ASP.NET application runs with a default user name and password which are : user name : machine password : Autogenerate now these stuffs are present in machine.config file which you can find at "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\" folder. In this file you will find a tag named "processModel". Two of the attributes of this tag are "userName" and "password". Now whenever the user name is "machine" the ASP.NET runs with the low priviledged account ASPNET. To change this, you need to specify your windows username and password in machine.config and then try to run your application. I'm not sure but you might need to restart IIS... Hopefully this will solve your problem. regards, Aryadip. Cheers !! and have a Funky day !!
Hi Aryadip, Thanks you for your advice. =) I've tried to set the userName and password attributes to my window logins in machine.config, but after resetting iis, I am getting this error when trying to debug: "Unable to start debugging on the web server. Server side-error occurred on sending debug HTTP request". Do you think there's other solutions? Because I am not sure if changing the machine.config would be ideal since this website would be used by multiple users, which means all users will be using my authority!? =\ Anzy