.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Remote administration within domain with alternative credentials

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :.NET Framework

Hi all

Pls. forgive me if I picked the wrong forum

Ref: Visual Studio 2008 (C#), windows application project for a Win2003 domain environement.

Im having  a problem with System.ServiceProcess.ServiceController class if I want to run this under an alternative user credentials, It seems not be a simple way to do this.

If possible I would like to use the ServiceController class because it provides really nice implementations for handling all needed operations when it comes to operate Services, especially dependencies.

I've tested it running as a member of Domain admins and it works great, much esier than using WMI (ManagementObject...)

On the other hand, WMI provides a way to "run as" by adding a ConnectionOptions to the Scope object

I also tried Impersonation using a class created on the article http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306158 

The impersonation process works, but now the ServiceController failes due to privileges!?! and I was impersonating the domain Administrator himself.  Exception is: System.InvalidOperationException,  Text: Cannot open Service Control Manager on computer 'TESTPC'. This operation might require other privileges.

So my quest

View Complete Post

More Related Resource Links

How do I preserve __viewstate between cross domain posts or how do I get a __viewstate of a Remote S


Here is what I want to do:
I have a local site in which I want to display data from a remote site
Lets say: I want to display data of http://www.abc.com/Default.aspx on my localhost

Now Default.aspx requires some post-data which it sends to itself. Thus the __viewstate and __eventvalidation are posted back to it by itself. I want to directly post the data to Default.aspx from localhost without opening Default.aspx and display the Default.aspx's response on my localhost.

The WebApp on http://www.abc.com is configured for __eventvalidation i.e. I cannot post-data to it from my localhost without getting a __viewstate from it. I also have to post the current __viewstate of http://www.abc.com/Default.aspx to itself

How can I accomplish it?

Get folder(directory) size of Remote server(W2k3) with credentials



I'm trying to calculate folder size of remote server.I have credentials of server.By using WMI,I could fetch the existing Logical drives in remote server. But,couldn't get Folder name or details..Here,my folder is not shared one..I like to get WMI solution for it..if it not possible,atleast any dos commands to get file size of remote machine like this,  \\ServerIP:username@password\\foldername -dir/s  . .


It's urgent!!! thanks in advance

Access to remote.domain


Hi to all, I have a question regarding my network and access to remote.domain.com from remote location. I created Sharepoint and it is working well from whitin organization. I created A record =remote  on ISP DNS, my network is like this

ISP----router1------------W2k8R2 RRAS------------------inner network with DC .....

I opened on router 1 987 port and forwardet to w2k8R2 and there again I forwarded to DC. Is that ok or I can just forward it directly to DC.

Sharepoint is still not accessible from outside.

How to get Clients Machine User credentials Username and Domain


I am trying to retrieve the loged in userName and Domain of the Clients machine. 

 string IP = (string)Request.ServerVariables["REMOTE_ADDR"];

 string IP = (string)Request.ServerVariables["REMOTE_ADDR"];

   Able to retrieve the Clients Machine IP but need to get the Remote Computer User details.


how to connect remote sql server on non domain network using SQL Server authentication



i m newbie on sqlserver.I had manage to build a database (MS SQL SERVER 2005 standard) with a vb.net 2008 and tested well with local machine. and wanted to put a software on client. and   some-how manage to stucture a security model on server authentication. but still not clear on user management. and others.

will anybody help me step by step how to connect remote sql server on non domain network using SQL Server authentication


Thanking you advance



How to Acess VSS from a remote Computer


i acess vss from lan with no problems and now i want acess from a remote computer not in a Lan

I need access over the Internet

What are settings i need to set up in the server and my client machine

VS2010 Professional .NET 4.0 Remote Debugging ASP Website Project


Trying to remote debug ASP website from VS2010 Pro to Windows Server 2003 machine.  Specifically, trying to debug a Web Service, but breakpoint says, "The breakpoint will not currently be hit. No symbols have been loaded for this document."  This happens for all compiled code though.  I have read this is due to missing PDB files and the work around is to manually copy them, as noted here.  Problem is, I cannot find any PDB files for my project, except referenced libraries, which I can remote debug.


  • web.config has <compilation debug="true">
  • Debugger is attached to wewp.exe process on remote server
  • Installed VS2010 remote debugger from DVD (as I can remote debug referenced libraries)

This is beyond frustrating.  I migrated my code from VS2008 .Net3.5 to VS2010 .Net4.0 to take advantage of the inherent multithreading framework.  Debugging works when using local host and was stable until deployment to test server.

Thanks in advance,


AutoGenerateSelectButton="False" ignored when using Domain Service


Crosspost from RIA Services forum: http://forums.silverlight.net/forums/t/196466.aspx

I'm creating a Dynamic Data application in VS2010 and have recently switched to using a Domain Service to give greater control over the data presented to the client. I've noticed that the AutoGenerate<Action>Button attributes on my GridView are being ignored. The presence of the Edit and Delete buttons appear to be contingent on the existence of Update and Delete methods on the partial classes autogenerated in the Domain Service, but i'm not seeing how to control the generation of the Select button. Is there a way to control this from within the Domain Service class?

Dynamic Data, Domain datasource, Poco and lookups


Mr. Edward,

Excuse my question but: it is necessary to involve in our projects something more than just Dynamic Data or should we make use of all other features available in VS2010 (which will make assume taht they had been left out of the Dynamic Data framework) like: wef, poco, azure, wcf, cloud, mvc, silverllight, ajax, odata, agile, workflow, etc.?

Sorry my ignorance, I'm just transcribing names as they come to my mind and of which I don't know anything about


Carlos Porras (El Salvador)

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

How to authenticate local user usin ldap or non domain authentication



I created one application, and I need to authenticate local user. This user is the user who is login to his/her Personal Computer.. Main thing his that he/she does not in any DOMAIN... I want NON-DOMAIN authentication.. any how.... please help...

Security negotiation failed because the remote party did not send back a reply in a timely manner. T



Dear All i have created one simple service

like this

namespace WcfService2
        public class Service1 : IService1
        public string ShowEmpName(string strFirstName, string strLastName)
            return strFirstName + strLastName;

after executing in .net command promt i got 2 files

service.cs & output.config

after that i create one class file like this

namespace WcfService2
    public class clientcs

        static void Main(string[] args)
            Service1Client client = new Service1Client();
            string strResult = client.ShowEmpName("Pradeep", "Deokar");

Web Deployment with IIS settings of remote server


Im trying to deploy a web application project (VS 2010) via team build (TFS 2010), i got to use IIS settings of development server for deployment. So from the project properties I configured the web projects to use Custom web server, (enabled radio button), once i do this the Option in the tab Package/Publish Web "Include all IIS Settings as configured in IIS manager" gets disabled and as a result the deployed web project does not have this IIS settings.

What am I missing here, Im not using the option "Use local IIS Web Server" because the build happens in a build server and would try to take local IIS settings for packaging which is not present.

If this is not possible, suggest me any workaround. Any help on this is greatly appreciated.

Automatic Batch Printing in ReportViewer Remote Mode


Please help me, i have a properly working codes that is capable of the following:

1. Printing of Reports from ReportViewer without using the build-in print ICON in the actual ReportViewer. to view the working for the printing alone please click here.

2. Batch Printing by making a loop and placing a checkbox on the gridview where the needed paramerter (DataKeyNames ID) is retrieved then pass to the ReportViewer

This is my Code

foreach (GridViewRow row in GridView1.Rows)
            CheckBox chk = (CheckBox)row.FindControl("CheckBox2");
            if (chk.Checked)
                ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://TestServer/ReportServer");
                ReportViewer1.ServerReport.ReportPath = @"/Tavern/StudPaymentReport";
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                ReportParameter[] rptParams = new ReportParameter[1];

                rptParams[0] = new ReportParameter("ClientID", GridView1.DataKeys[row.RowIndex].Value.ToString());


Patterns in Practice: Internal Domain Specific Languages


Jeremy Miller explains how internal Domain Specific Languages can help you craft code that is easier to read and write. His bag of tricks to improve your programming includes extension methods, fluent interfaces, object extensions and use of the semantic model.

Jeremy Miller

MSDN Magazine January 2010

Domain Models: Employing the Domain Model Pattern


In this article, we'll go through the reasons to (and not to) employ the domain model pattern, the benefits it brings, as well as provide some practical tips on keeping the overall solution as simple as possible.

Udi Dahan

MSDN Magazine August 2009

Toolbox: Static Analysis Database Tools, Managing Remote Computers, And More


If you want to apply static analysis to your databases, connect to remote computers, find out more about the Entity Framework, or just check into some cool podcasts for your daily commute, then you'll want to read more about these latest tools and resources.

Scott Mitchell

MSDN Magazine July 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend