Creating A File Using Impersonated Credentials Via A Service?
Nov 4, 2010
I've spent alot of time digging thru the forums to research this problem, and to get the right code. I'm wondering now if this is a system configuration problem, or something else with my code.
Firstly, i'll tell you that i've already put the service account on my machine local security policy that says 'allow to act with/as operating system'.
Running this code from an application, it works just fine:
I have to admit that I was sceptical it would work... but below is the code. I had to make a minor change to the code you suggested. Whenever I tried IPC$ it would return a 53 result code, even though I'm sure the share exists. So at the suggestion of another website I removed the share and just the computer name and this worked.
I'm attempting to consume a HTTP Basic Auth Secured PHP WebService using VB.NET. I've so far managed to get 100% perfect integration by adding it as a Web Reference and doing the following:
Dim Credentials = New System.Net.NetworkCredential("username", "password") Dim CredentialCache = New System.Net.CredentialCache() CredentialCache.Add(New Uri(MyWebService.Url), "Basic", Credentials) MyWebService.Credentials = CredentialCache MyWebService.PreAuthenticate = True
I can also successfully add the webservice as a 'Service Reference' and this also works fine, as long as i turn off all HTTP authentication on the SOAP server.
My problem is that I can't find any documented means of sending basic HTTP Auth Credentials when using Service References as opposed to 'Web References'
Am I right in my understanding that 'Web References' are a legacy method of Web Service consumption?
I was able to programmatically launch a service on my development server from a workstation using the ServiceController class with no problems.
When I try to programmatically launch the service on my production server from my workstation, I get an access error which means I do not have rights to run the service with my logged in ID on the workstation.
My question is, is there a way to launch the service using different credentials? I do not see anywhere to input these credentials in the ServiceController class.
When I try to call a [Java] web service from .NET, I am getting what appears to be a security credentials issue. CWWSS5509E: A security token whose type is [http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken] is required.Is it even picking up the credentials that I am trying to pass? At this point, I just want to make contact with the web service and get access. In my example, ServiceReference1 is a generated Web proxy class.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim myLocateProfileBySourceSystemId As New ServiceReference1.locateProfileBySourceSystemId
I am developing a small tool to allow our Windows admins to do stuff like create/delete users, mailboxes and other useful stuff.The current version has to be launched with RunAs as it requires domain admin privileges to do a lot of the stuff. Now, to overcome this I'm trying to incorporate a dialog box that prompts for credentials when the application starts and then uses said credentials throughout the application. I have it working for the AD interaction but one of the tasks the tool needs to do is create folders on a remote server and share them.Is there any way to create folders using alternate credentials? Maybe, once I have the credentials, quit the application and re-launch it with the specified credentials?
I have an application which need to interact with database and update it as required.Below i have 2 procedures AuthencateBufferLogin() - Used to impersonate the user (i.e., to work with other user, to perform some task
QueryDataBase() - Used to Query database i could able to copy files and create files as desired by using this Buffer login which has permissions in the destinated.
Note : permissions for other users were removed in these folders for security reasons
Ideally I'd like to be able to copy/move between an accessible folder on my local drive and a network share that I don't have permission to access (but the application would). I am using impersonation to give me access to the files in the network share but using System.IO File.Move or File.Copy forces me to use the same credentials for each location. Is there a way around this?
I want to download a file in VB.net from a website that requires credentials, all my users have their credentials to this website saved in their IE settings.Is there a way to download a file from this website using the IE credentials? I'm trying to avoid from asking my users for their credentials.I need to download many files, so i need a way to download the files programmatically.
I am trying to read in high scores from a text file that look like this
Name1 Score1 Name2 Score2 Name3 Score3
etc.
I can write them out fine, but reading them in I seem to be having a problem with. I have read in the first name ok but when I try to read in the second name, it is giving me the 3rd name. Code below
[code]...
Can somebody please explain why lblName2 is becoming the fifth line of text instead of the third? I realise I have probably not used the correct type of variables
I want to create some sort of method of creating a web service that will run automatically and run DB queries and some API calls which will then store data that I can use/call without taking the processing or time penalty of doing it every time a user access my web service. how to implement something like this
My first post as an absolute last resort. In 8 years of programming, I have never posted to a programming forum and have always been able to wiggle my way out of any diffficult project...Until this project.Every step of this project is new for me (Windows service, ini file, IIS, FTP, cmd line params, comparing file specs programmatically, using a timer, and even VB.NET is still confusing to me after several years in VB6 ). Dreading posting b/c I have so many questions. I have finished the internet, been to the end and back. Found endless suggestions of code and links and forums and only gotten more lost in the process.
I am trying to create a VB.NET app, that most likely will need to be a service, for our external clients' PCs. These PCs are not connected to our network. This app will be invisible to the user and will need to perform several tasks including:
I thought that creating a simple system service under VB .NET would be a piece of cake. Boy, was I wrong. First, I find general postings through Google that say you should use the Windows.Forms.Timer. Then, I found conflicting information that says you have to derive the timer from a timer class through code to make it work. Then, people are reporting all sorts of trouble using the various types of threads available. I can't debug threads using the VS 2010 Just-in-Time debugger for obvious reasons (although, I don't know if there is an alternate method to doing this).My project is an application launcher (similar to cron) that will fire off periodically within a certain amount of seconds. I am trying to use the Process.Start() method. I have a Beep() function as the first instruction, and the Process.Start, along with a Process.WaitForExit method to make it block as the last instruction. I had my code doing this through timers, but now I am starting to use threads. No difference in execution. The over-ridden OnStart method does kick off (as I am certain through debugging), but nothing ever happens when starting the service in production, as if it were ignoring all my code. Putting loops and logic in the OnStart method yields a process that won't start. I know it is a threading issue, but I also know it must be mandatory to use threads. I am now dumbfounded as to how to make this work. I am curious to know the solution.
In addition to the service class, I have a ServiceInstaller and ProcessInstaller implemented that I copied verbatim from MSDN.Here is some of the code I am trying to work with. Note that this simply reflects the current state of my code in trying to implement the logic within a thread instead of a timer (which to me would be optimal):[code]
What I am looking to do is write a VB.NET program, as a service that reports anything on client1 that I want (say the fact it is online) to a database on the internet, so I can look on management1 and see the online status of the machine (assuming management1 has a connection to the online database).
What is being reported doesn't matter, what I am looking at is a starting point to create a system like that. I have googled obviously and come up with nothing, I'd just like a "starting point" or some documentation to look at for creating something like this. The service doesn't look too difficult but the periodic reporting of online status or ANYTHING to any kind of database is not something I am sure how to deal with.
I already have setup a VBS that reports information to an ASP script that then places it in a database but I don't know how I would create say a "keep alive" connection for a vb.net service.
i have a Windows service that is hosting a WCF service through net.tcp and this is working great. I have also created a WCF service application. I am trying to add the net.tcp service reference to the service application. Then I add it to the GAC that goes ok but if I try to RegAsm the WCF service application to allow it to be called from Server.CreateObject I get the error:
Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.
It does not work. I have tried to call it through a class library but this does not work either as the end point is not set correctly.
automatic scheduler apart from creating windows service in .net or OS batch scheduler?I 'm aware of this two, Is there a 3rd way to create automated process in .net.I having facing limitations in creating windows service like I have semi admin rights so it doesn't allow me to install windows service also I can't view the windows service.
I have a VB2008 application which can control a windows service i.e. start, stop, pause etc. This runs ok on a Windows XP machine but not on a Win 7 machine (message is - Service error cannot open <service name> service on computer '.') ( if I stop the UAC then it runs ok ). It seems to be a rights issue,
I am trying to write a program that goes to a webpage and gets the html and puts it into a mshtml document but I always get an error. I know this example works when the webpage doesn't require Credentials. By the way i'm using vb 2008 express.
Dim theCredential As New System.Net.NetworkCredential("username", "password") Dim Doc As mshtml.IHTMLDocument2
(Control PanelAll Control Panel ItemsCredential ManagerHow would I access Windows credentials from a Visual Basic form? This is not for hacking purposes, simply knowledge and so I can recover my OWN passwords
I want to download my update files for my program from an FTP server, but i need to login first with the credentials. I have tried many things, used some examples on MSDN, googled a lot, but i can't find the code that i'm looking for... I also use a DLL of someone that i've imported into my project. I don't know if that harms my part of being unable to log in.
I have ZERO experience with FTP servers or Network Credentials, i've learned the little things about it on google.
I have a routine that sends an email via SMTP. I'm using googles smtp server - "smtp.gmail.com". I'm using my gmail email address/password as the authentication credentials. My webpage form consists of the following fields:
In testing this functionality, I've found that my problem is that when the email is sent, it uses my authentication email address (my gmail email) instead of the "User's Email Address". If I can't see the User's email address, this functionality is useless.
Here is my code below.
Private Sub FormatEmail() Dim Email_Sent As Boolean = False Dim toEmail As String = "blakemc@mail.com"
I am writing a program which will require a user to login with a different account from the one they use to logon to the computer with (as they have a normal account and an admin account). The program needs to run under their admin account.
I have made a login dialog that authenticates them ok, but my question is is there any way to make another form run under the credentials typed in on the login form? i.e program loads up the login form, but there after the program uses the credentials supplied in the login form.
I am in support of a database driven windows application wherein the data may come from local or remote system (depending on some configuration files).Currently MS ACCESS Database is being used.Application runs smoothly when connected to local database.But when trying to connect to a remote PC Which is password protected,i am getting the following error"The Microsoft Jet database engine cannot open the file '\XXX.XXX.X.X YYYY ZZZ.mdb'. It is already opened exclusively by another user, or you need permission to view its data.i am providing the credentials for database in the connection string as below.
I am trying to "behind the scenes" log myself into a website, from the VB code behind my ASP.NET website. But I am dumbfounded as to how to do this.
As far as I know I should be using the WebRequest or Webclient class. That is about as much as I know. I am not sure how to use the class.
I want to click a button on my website and have its Click event send a username and password to another website. This other site isot affiliated with mine. I realize the concept may seem stupid, but I plan on taking this further later, but Just need to know this now.
I want a supervisor override capability for my application.I want to provide a username login prompt (including domain). If the user is in the approved list and the password correct, show advanced controls.What .NET code / functions allow this?
NOTE: VB.net answers preferred. C# also accepted.
EDIT: the logged in user is not the user authorizing the override.
I want to diaplay a msg box in vb.net when correct credentials are not entered by user. now i m able to display the msg box but the problem is it is displayed even ehen the user enters the correct credentials . its doesnt give any error but the problem needs to be fixed. [code]