Code Running In Class Inherits From ServiceBase Doesn't Have Have Credentials Of Logged In User?

Jul 9, 2010

I have a window service that Inherits System.ServiceProcess.ServiceBase. While running in debug mode (havent tested compiled), the thread does not see the current user credentials. I need the credentials so I can set up the WebProxy and I would prefer to use the account that service is running under instead of passing the user and pwd as a string.Can someone help me figure out why the code running in the class the inherits from ServiceBase does not have have the credentials of the logged in user?

View 1 Replies


ADVERTISEMENT

Username Of Logged On User When Run With Other Credentials?

Sep 12, 2010

I have a client/server application running in a windows domain environment, the client application is started at log on by a scheduled task using domain admin credentials, i need to be able retrieve the username of the user who logged onto the workstation but all the methods i have tried returns the user that was used to execute the program.I have tried:

Environment.UserName
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Environment.GetEnvironmentVariable("USERNAME")

All of these return the account i used to run the application, not the user who is logged on.

View 5 Replies

.net - ServiceBase Credentials / Read In High Scores From A Text File?

Dec 1, 2011

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

View 4 Replies

Get The WindowsIdentity Object For Logged-on User In An Application Running As Another User?

Jul 18, 2011

I'm running an application under an account that is not the account logged-on to the PC.

Within the application I need check if the logged-on user is a member of the Administrators group. Below is the code I'm using. From what I've read, WindowsIdentity.GetCurrent() should return an object associated with the logged-on user. It doesn't, it returns the same information as the call to System.Threading.Thread.CurrentPrincipal. Which is the information associated to the ID running the application, not the logged-on user.

[Code]...

View 8 Replies

C# - Make Sure That The Class Defined In This Code File Matches The 'inherits' Attribute?

May 28, 2012

Sometimes in my web applications I used to get this sort of error, I have no clue why is it coming however if I refresh the page few times the page is loading normally.I am using .net framework 2.0 and visual web developer 2005.

View 1 Replies

Create A New Class That Inherits From The Base Form Class And Define A New() Method With Parameters?

Oct 1, 2008

I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).

[Code]...

View 6 Replies

Class C Inherits Class D Is Class D A Superclass Or Parent Of Class C?

Dec 16, 2009

If Class X is within the scope of Class Y, is X a subclass of Y?If Class A is a sub Class of B, then is Class B considered a super class of A?if Class C inherits Class D is Class D a superclass or parent of Class C?if Class E extends Class F then we can consider Class E a child of F?if Class G inherits Class H and is within the scope of Class I then who is the parent of Class G? Classes that inherits Class J and classes that are within Class J are all sub classes of Class J?

View 1 Replies

Overrides ToString When Inherits Collectionbase Doesn't Seems To Work?

Jan 8, 2009

When I make a class that inherits from Collectionbase the overrides of ToString function doesn't seem to work properly.

Public Class House
nherits CollectionBase

[code].....

View 2 Replies

.NET Class Inherits A Base Class And Implements An Interface (works In C#)?

Apr 9, 2010

I am trying to create a class in VB.NET which inherits a base abstract class and also implements an interface. The interface declares a string property called Description. The base class contains a string property called Description. The main class inherits the base class and implements the interface. The existence of the Description property in the base class fulfills the interface requirements. This works fine in C# but causes issues in VB.NET.

[Code]...

View 5 Replies

Class That Inherits Another Class In Which There Are Objects That Are Disposed In Dispose Procedure

Feb 14, 2010

If I have a class that inherits another class in which there are objects that are disposed in the dispose() procedure, do I use mybase.dispose? ex Class A inherits Class B. [code]

View 2 Replies

Running Program Under Different Credentials?

Apr 27, 2010

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.

View 2 Replies

Code If User Doesn't Select Messagebox Button

Feb 26, 2009

I have an application that has a timer. Every hour, the application will see what time it is. If it is after 5 P.M., then the application will shut the computer off. (For power saving purposes)I have a messagebox pop up warning the user. I want the user to be able to hit "Cancel" on a dialog box if he/she is still working on the computer and reset the timer to ask again in about an hour. If the user isn't there to select a button on the messagebox, I want the computer to turn itself off. But I can't get the code to skip the dialog box after so many seconds. [Code]

View 12 Replies

Loged ON User COde Doesn't Work In Some Computers

Jun 22, 2010

I have this code that gives me the user logged on name of a remote computer, but if i run the program in certaing computers, it returns with the error "Not Available Due Restrictions" which is set if the scope cant connect... why it connects fine in some computers and other not..is there something i have to add to the code for it to run fine in any computer

[Code]...

View 1 Replies

Assign To Variable If Inherits From Class .NET 2.0

Mar 31, 2009

I think I remember reading somewhere that it was possible to assign items to a variable if the item inherited from a base class, but I can't remember how.

I want to have a class that gets properties set and one of the properties is an error code property. I want to assign any exceptions that occur to the property, but it could be any type of exception. I remember that all exceptions inherit from the Exception class.

How can I assign an exception to a property based on the class it inherits from?

View 4 Replies

How To Prepopulate A Class That Inherits Combobox

Sep 24, 2010

I'm extending the ComboBox class in VB.NET and I'm running into a problem prepopulating the collection. I try to do so by using Me.Items.Add() calls in the New() sub. However, once I place the control on a form in the form designer, Visual Studio automatically adds those items to the collection in form designer, then they are added again at runtime. How can I make them only added once?

View 1 Replies

VS 2010 Class That Inherits From Picturebox

Apr 5, 2012

I have a class that inherits from the picturebox class, is represents a gauge. In that class I have an overriden function : [code]and I have on my screen what I expected. But in my form I have a timer that generates a new value for the gauge.[code]For some reason the refresh doesn't work. The gauge doesn't change, the overriden onpaint doesn't get triggerd again. anybody has any idea why?

View 12 Replies

[02/03] Base Class Called PageBase And Then A Derived Class TestPage That Inherits From PageBase

Feb 4, 2009

I have a base class called PageBase and then a derived class TestPage that inherits from PageBase. In PageBase I have overridden the OnInit() and when it is called and I inspect the value of 'Me', it is of the type of the derived class and not the base class. My question is how does inheritance really work? For instance, when instantiating TestPage does an instance of PageBase get created too?

Here is my code;

Partial Public Class TestPage
Inherits PageBase

Public Sub New()

[code]...

View 7 Replies

Using Inherits Within A User Control?

Jul 11, 2011

In another post entitled "Creating a button in vb that could get the path of any file/folder or application in a textbox" some code for creating a FileTreeView control is given which starts

[Code]...

View 3 Replies

Permissions - Code Is Not Running On Restricted User On PC

Feb 27, 2009

I have some code that queries all the printers on our print server and returns a list. I need this code to work so please don't reply with comments asking why I am using it when you can simply type \Server to list the printers (I know this, but need the code to work as part of a larger application). When running the following code on an IT PC with admin rights, it works. When running on a restricted user PC, it doesn't. How can I add permissions in code to elevate the EXE to 'run as administrator'? [Code]

View 14 Replies

How To Store An Instance Of A Class Which Inherits From NameObjectCollectionBase In Settings

Nov 30, 2010

I have created 3 classes which inherits from(System.Collections.Specialized.NameObjectCollectionBase)

The first class "SQLCommandsCollection" stores "SQLCommands" in a collection.

The second class "SQLTableNamesCollection" stores "SQLCommandsCollection" objects in its collection.The Third class "SQLDBNamesCollection" stores "SQLTableNamesCollection" objects in its collection.

Ultimately I will sit with a "SQLDBNamesCollection" collection which contains all Table names and its respective SQLCommand objects.

I would like to store this "SQLDBNamesCollection" object in my.settings("QueryViewerQueriesPerTableNamePerDBName")
at runtime but I am unsure what this settings type should be.

I have tried system.oject but this does not seem to work as I get an "Unable to cast object of type 'System.String' to type 'Fusion.SQLTableNamesCollection'" exception when I try to retrieve from settings. See below code.

[Code]...

View 6 Replies

Specifying Inherits / Implements On Generic Class With Multi-Constraints

Jun 7, 2010

When I write the following statement in VB.Net (C# is my normal language), I get an "end of statement expected" referring to the "Implements" statement.
<Serializable()> _
<XmlSchemaProvider("EtgSchema")> _
Public Class SerializeableEntity(Of T As {Class, ISerializable, New}) _
Implements IXmlSerializable, ISerializable
...
End Class

The C# version that I'm trying to emulate is:
[Serializable]
[XmlSchemaProvider("MySchema")]
public class SerializableEntity<T> : IXmlSerializable, ISerializable where T : class, new()
{
....
}

View 1 Replies

Transparencies - Quickly Made Up A Class That Inherits Listboxes And Uses

Aug 10, 2010

I have quickly made up a class that inherits listboxes and uses

[Code]...

View 4 Replies

Forms :: Code Running - But User Still Can Access Form ?

Feb 23, 2010

I am trying to figure out how to have a form running in a loop waiting for the user to input something....

such as:

private function looping()
while 1=1
if textbox.text = "hi" then do_something()
endwhile
end function

How can I do this? threading? Backgroundworker?

View 3 Replies

IDE :: Partial Class Code Behind A Dataset Object / Is It Running In A Separate Thread

Jan 27, 2010

I am instantiating a form object in my code behind the dataset just to access some form level variables and to occasionally set a label in the navigator bar. Recently in the b2 Team version of VS2010 there are some strange errors thrown in the immediate window and then I'm tossed out of debug mode and back into the IDE. This code has been operating for some time in this project without this behavior. A team member has just reproduced the behavior in his development machine also.The error that starts the shutdown of the debug instance is this: Control accessed from a thread other than the thread it was created on.

View 4 Replies

User Defined Directories - Code - "Project Processing' Section Doesn't Run At All?

May 28, 2009

I am having trouble with this code. Can someone tell me why the "Project Processing' section doesn't run at all? The 'Client Processing' section runs and executes find but it seems the 'Project Processing' section does not.

Code:

Public Sub btnExecute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExecute.Click Dim mBaseFolder As String Dim mProjectFolder As String Dim mClientName As String Dim sClientFolder As String Dim sProjectFolder As String

[CODE]...

View 3 Replies

2003 - Program Running Under Alternate Credentials - Option To Open A UNC Path To A Network Share

Sep 8, 2010

I have a program written in VB.net 2003 that are folks run under alternate credentials. Inside the app there is an option to open a UNC path to a network share. We were running Windows XP SP3 and IE6. The code is simple just a call to the explorer.exe with /root,\UNCPath. After installing IE 8 onto the machine this no longer works. Best I can tell the code is still working but now being executed in non interactive mode so nothing opens up. You can however see a new spawned explorer.exe running under the system account for each attempt at opening a UNC Path. Any ideas what IE8 could have done to cause this behavior?

View 4 Replies

Create User-Control That Inherits The Functionality Of A TabContol

Apr 16, 2009

I want to create a User-Control that inherits the functionality of a TabContol.

I begin by starting a new project of the type Windows Form Control Library. Next I place a TabControl on the UserControl designer surface and Dock the TabContol to Fill the UserControl.

I go to the code editor for the UserControl and enter the following line of code.

Inherits System.Windows.Form.TabControl

Then I run the program and get an error. Intellisence recommends that I use one of two recomendation. When I accept the recommendation I and try to run the program the problems esculate.

The design-surface is no longer accessable.

I try to comment out the problem lines of code in the UserControl1.Designer.VB file but that doesn't help.

How can I create a UserControl that Inherits the Properties of the TabControl so that the properties of the TabControl are visable in the Properties Window?

View 8 Replies

Show Two Rectangles On A User Control Which Inherits Picturebox

Mar 7, 2009

I need to show two rectangles on a user control which inherits picturebox.For that I have used pictureboxes (so that i can move and resize them), with transparent background. [code]

View 6 Replies

Local WMI Connection With User Credentials

Nov 21, 2011

In VB.Net, I'm trying to connect to WMI on my local computer with different credentials (the user won't have admin rights) and I get this exception : « User credentials cannot be used for local connections » Here's the code :

[Code]...

View 1 Replies

Storing User Network Credentials?

Nov 1, 2011

We don't want to get the password, we only want to store the user credentials so when they do work on the application we can apply their usernameto each operation and when they are done with an operation and do a digital signature by scanning their badge we want to compare the user's credentials with the stored credentials to ensure the user has logged in and is the current user.1. User 1 logs into the program using their username/password for windows.5

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved