networkcredentials

How to authenticate in an ASP.NET MVC application from a console application

被刻印的时光 ゝ 提交于 2019-12-21 05:24:21
问题 I have a console application that sends a XML to a MVC application and receive another XML as a response. It works perfectly, but I want to add authorization (for obvious reasons). Here is the code from the console application: using (var wc = new WebClient()) { return GetXmlFromBytes( wc.UploadData("URL", GetBytesFromXml(xmlToSend)) ); } And here is the code from the MVC application: public ActionResult DoSomething() { XElement xml = XElement.Load(new System.IO.StreamReader(Request

Get Client User Name from a Web Application running in a Web Server with Windows Auth Enabled & Service Account

孤街醉人 提交于 2019-12-14 04:21:00
问题 I have encounter the following issue while deploying my application into a WebServer, The code that i have was "Usercheck = My.User.Name" but that will return the Service Account for the instance that is running my webapp, so i need to display "evilla" which is my current windows credential, when i try to connect for the first time to the webapp it asks for my network credentials. Is it possible to grab my windows username and not the service account?? (i'm conecting remotely to the app) i

C# single file FTP download

拈花ヽ惹草 提交于 2019-12-12 10:01:35
问题 I am trying to download a file usng FTP within a C# console application, but even though I now the paths are correct I always get an error saying "550 file not found". Is there any way, to return the current path (once connected to the server)? // lade datei von FTP server string ftpfullpath = "ftp://" + Properties.Settings.Default.FTP_Server + Properties.Settings.Default.FTP_Pfad + "/" + Properties.Settings.Default.FTP_Dateiname; Console.WriteLine("Starte Download von: " + ftpfullpath);

Apache NTLM Auth from C# client do not work with self defined NetworkCredentials

浪尽此生 提交于 2019-12-12 09:57:37
问题 I have a office plugin that connect a service using HttpWebRequest . Inside a domain I pass CredentialCache.DefaultNetworkCredentials so all is fine. Outside a domain a user need to provide username, domain and password. This don't work atm. Some part of the code out of it: CookieContainer cookies = new CookieContainer(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = WebRequestMethods.Http.Post; request.AllowAutoRedirect = true; request.CookieContainer =

HttpWebRequest with basic authentication fails with 401 error for DefaultNetworkCredentials

谁说胖子不能爱 提交于 2019-12-11 13:22:12
问题 I am testing an application with a local Web server (IIS, Windows 8), the site requires Basic authentication, and as long as I explicitly pass my credentials, everything works fine: request.Credentials = new NetworkCredential("User", "Password", "Domain"); request.PreAuthenticate = true; But I would like to use integrated security, so I tried to change the first line as follows: request.Credentials = CredentialCache.DefaultNetworkCredentials; (I also tried DefaultCredentials) I checked the

NetworkCredential.Domain Property

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 11:47:18
问题 MailAddress Sender = new MailAddress("SomeOne@yahoo.com", "SomeOne", Encoding.UTF8); SmtpClient Client = new SmtpClient("smtp.mail.yahoo.com",465); Client.Credentials = new System.Net.NetworkCredential(Sender.Address,"Password",Domain??? ); just out of curiosity what is the third overload of NetworkCredential I mean what we need to pass argument for Domain property . I searched on net but but no one used it(domain property) .I tried "Yahoo.com","@Yahoo.com","Yahoo" bot no every time same

How do I tell a WCF client proxy class to use windows authentication and the WindowsPrincipal of the already logged in domain user as credentials?

一个人想着一个人 提交于 2019-12-10 21:15:23
问题 I've got a WPF windows client that calls a WCF web service. The user is already logged in on the windows domain before starting the application and the WCF service uses windows authentication. I want the WPF client to use the WindowsPrincipal of the already logged in user when calling the WCF service. I do NOT want to create a new NetworkCredential instance with an EXPLICIT username & password to do this, simply because asking the user to log in twice (in Windows and the app) is ... well

Window 8 consuming SharePoint REST Interface through FormsAuthentication?

谁说我不能喝 提交于 2019-12-10 11:01:32
问题 I have created a sample Windows 8 Application getting SharePoint 2010 list data using REST Apis like _vti_bin/ListData.svc I am using NetworkCredential to access the list its working fine. How can I achieve the same results using FormsAuthentication? Code for NetworkCredential: context = new CentralAdministrationDataContext(new Uri("http://<SharePoint_URL>/_vti_bin/ListData.svc")); NetworkCredential credentials = new NetworkCredential(); context.UseDefaultCredentials = false; context

How to validate domain credentials (from native code)?

冷暖自知 提交于 2019-12-10 04:03:03
问题 i want to validate a set of credentials against the domain controller. e.g.: Username: joel Password: splotchy Domain: STACKOVERFLOW In .NET 3.5 and newer you can use PrincipalContext.ValidateCredentials(username, password). Otherwise you're in trouble. Following the code in the Microsoft Knowledge Base article How to validate user credentials on Microsoft operating systems, i get to the point where you call AcceptSecurityContext: ss = AcceptSecurityContext( @pAS._hcred, //[in]CredHandle

CredentialCache.DefaultCredentials how to get the username and or password

最后都变了- 提交于 2019-12-08 04:05:43
问题 For debugging purpose I wanted to look in the value of username and password of CredentialCache.DefaultCredentials. I see that there are 2 properties of username and password in CredentialCache.DefaultCredentials and doing CredentialCache.DefaultCredentials.username CredentialCache.DefaultCredentials.passwrod does not print anything what should I do? 来源: https://stackoverflow.com/questions/40585014/credentialcache-defaultcredentials-how-to-get-the-username-and-or-password