Last post Mar 20, 2014 02:00 AM by Happy Chen - MSFT
Mar 17, 2014 02:27 PM|Alex_808|LINK
Hello, Is there a way to perform a get request for a ressource on a different server needing windows authentication and having the user automaticly being prompted for his credentials
WebClient c = new WebClient()
//c.Credentials = CredentialCache.DefaultNetworkCredentials;
So instead of supplying Credentials in the backend I would like the user to be automaticly prompted for his Credentials. The 2 are not related....
Mar 18, 2014 03:35 AM|Happy Chen - MSFT|LINK
i hope that i understand what you mean. you don't automaticly prompt for his Credentials in the backend, other than you call window form API(.exe) for authentication.
i would suggest you try using ajax to call the authentication and prompt some inputs. when you try to download the data, you need to prompt the inputs and pass them to backend.
you can refer to the link for details:
WebClient accessing page with credentials
you also can try using Knockout.js and give up the WebClient.
please check out the link for more information:
Creating a Dynamic UI with Knockout.js
Hope it helps you.
Mar 18, 2014 03:24 PM|Alex_808|LINK
Hello Happy thanks for the reply. When I turn on WIndows Authentication on a page I don't have todo anything else and the user will be prompted for his credentials. I was hopping to get to same results when requesting ressource on another server prompt the
user with his credentials in the same way..
Mar 20, 2014 02:00 AM|Happy Chen - MSFT|LINK
When I turn on WIndows Authentication on a page I don't have todo anything else and the user will be prompted for his credentials. I was hopping to get to same results when requesting ressource on another server prompt the user with his credentials in the same way..
Sorry, i'm afraid that you cann't do the way as you stated above. if you want , you have to write your own codes with cookies, session etc. which is based on the user accounts in code-behind.
//c.Credentials = CredentialCache.DefaultCredentials;
//I tried to add credentials like this
//c.Credentials = new NetworkCredential("username", "password");
To use the built in security of Windows and ASP.NET, implement Windows authentication and authorization on groups and users. To use Windows authentication, you must adjust settings in both Microsoft Internet Information Services (IIS) and the ASP.NET
application Web.config file.
please check out the links for details:
How to implement Windows authentication and authorization in ASP.NET
ASP.NET authentication and authorization