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

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

How would I set a Enviroment Variable on Several remote Machines from one Application

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :.NET Framework
I think my title covers the high level, but for indepth; i need to be able to connect to a machine through and ip and set a enviroment variable, i have over 60 machines in different states all on one network that i need to do this for as well as someother things for the machine. currently this is being done through a PCEXEC command in a batch file they want more control on how this operates. I just really have no idea where to even start looking for the enviroment variable change(setting one on a machine that the app is running is simple we all know that. but on a external machine im lost) on a remote machine. any one have any ideas.

View Complete Post

More Related Resource Links

is application variable is overwritten?



in my website i have stored logged in user name into one application variable;

ie;Application["uname"]="Sam"; just like this.

where "sam" is user name taken from table when he logged in.My doubt is that,is another person is log in at same time in different computer then the application variable is overwritten or not?

is there is only one application variable is created for every user?


for each user different instances of same variable is created ?

pls,help me....

Accessing memory of a remote process (x64) from application (x86) - and the other way

Hi everyone, My program access a remote process, e.g. to get the text of ListViewItem. It uses ReadProcessMemory, WriteProcessMemory, SendMessage, LV_ITEM via PInvoke. Below is a little codesnippet. This doesnt work, when i compile for x86 and the remote process is x64 (or the other way). I know that is because the size of IntPtr - and so of the LV_ITEM-Structure - is different. Is there any way, to access x86 and x64 remote processes from the same application?  Is there any way to find out if the remote process is x86 or x64 and make my call's with a suitable LV-Item Structure? thanks Torsten Codesnippet: LV_ITEM lvitem = new LV_ITEM(); // Allocate memory in the remote process's address space string s = string.Empty; IntPtr pszTextMemory = VirtualAllocEx(hProcess,IntPtr.Zero,  1024, (int)(AllocationType.MEM_RESERVE|AllocationType.MEM_COMMIT), (int)(AccessProtectionType.PAGE_READWRITE)); lvitem.pszText = pszTextMemory; ... IntPtr pLVItemMemory = VirtualAllocEx(hProcess, IntPtr.Zero,  Marshal.SizeOf(lvitem), (int)(AllocationType.MEM_RESERVE|AllocationType.MEM_COMMIT), (int)(AccessProtectionType.PAGE_READWRITE)); IntPtr lvItemPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvitem)); Marshal.StructureToPtr(lvitem,lvItemPtr,false); WriteProcessMemory(hProcess, pLVItemMemory, ref lvitem, Marshal.SizeOf(lvitem), ref written); SendMessage(hListView, LVM_GETITEM

Error while Deploying WebMatrix Beta Application having SQL Database on Remote Server


Hello All,

I have created "DotNetNuke SQL Database Application" from the WebMatrix Gallery.

Now I want to deploy it on the remote server using Web Deploy method.

Without selecting SQL database, application is deployed successfully but when I select SQL database it gives following error:

Publish : Error - Make sure the database connection string for the server is correct and that you have appropriate permission to access the database. (Web Deploy provider is dbFullSql).

Can anyone have the solution of this error?

Thanks in advance....

Remote Debug an XBAP application in VS 2010



I have an XBAP application that I created in VS 2010.  On my local machine I browse to the XBAP on the hosting server, via the folder structure [UNC] and run it.  The application does load and start.  I then go to "Attach to Process" in VS 2010 and browse to the server [which has msvsmon.exe running], but I cannot see the process to attach to.  I can debug ASP.NET applications remotely with no issues.  What am I doing wrong?

Thanks in advance

How do I set up a webpart to access a terminal server remote web application?

I hope i am posting in the right place...


sharepoint site (MOSS 07) running on 2008 x64
SQL 08 running 2008 x64
TS server 2008 x32

I am trying to set up the webpart to access terminal server remote web application by following MS DOC -
Customizing TS Web Access by Using Windows SharePoint Services

I followed the steps on my sharepoint web server..  Do i need to install sharpoint services on the TS server..??

i am assuming

In the <SafeControls> section of the Web.config file, add the following line under the other SafeControl Assembly entries (as a single line):

<SafeControl Assembly="TSPortalWebPa

session variable and multiple web application instance


 I have a web application using window authentication. There are a search page and a edit page in the application. 

In search page, user can enter some search criterias in the textboxes and the search result will be displayed in the gridview by clicking the "Search" button. User can select any row from the gridview and it will take him to the edit page. 

 In the edit page, there is a "Back" button to take the user back to the search page. I use session variables to remember what the search criterias the user entered in the textboxes and what page number the user was in the gridview. So when the user goes back to the search page, the textboxes are pre-populated with the search criterias and the gridview is displayed in the correct page number.

The problem is:

If user1 opened one browser window and did a search using search criterias1, then user1 opened a 2nd browser window and did a search using search criterias2. When the user1 went back to the search page from the edit page using the first browser window, all the textboxes and page numbers are from the 2nd browser window, instead of the 1st one.

Can anyone explain this problem to me and how to prevent it? It will be helpful too if you can give me some links about the similar problem.

How To connect remote server in windows form application


Hi All

i have implementing one Windows application in that i need to get the Forex market quotes values form perticulat server how can i implement this i have some Php Code but i need to in C# application.

This is my Php code to receive the quotes form server;

define('T_HOST','');  // MetaTrader Server Address  

define('T_PORT',443);                   // MetaTrader Server Port
define('T_TIMEOUT',1);                  // MetaTrader Server Connection Timeout, in sec


define('T_CACHEDIR','cache/');         // cache files directory
define('T_CACHETIME',1);               // cache expiration time, in sec

define('T_CLEAR_DELNUMBER',1);        // limit of deleted files, after which process of cache clearing should be stopped

$MQ_CLEAR_STARTTIME = 0; // time
$MQ_CLEAR_NUMBER = 0;    // deleted files counter

// query quotes and parse result
                          // $re=MQ_Query($q);
$qRes = MQ_Query($q);
function MQ_Query($query,$cacheDir=T_CACHEDIR,$cacheTime=T_CACHETIME,$cacheDirPrefix='')

   $ret = 

How to send any collection object from .NET Application to object variable created in SSIS Package


HI All,

I have a question regarding SSIS -- How to send list object from .NET Application to object variable created in SSIS Package. In List object there are one lack records stored..This list object needs to be passed to SSIS Package. Please reply me back with any suggestion/solutions ...Required ASAP.

Waiting for your replies.





How to upload files to remote machine using FTP or other method in VB.Net 2005 (Windows Application)



I have to create an application to upload and download files using FTP.
Are there any classes, methods in VB.Net 2005(Windows Application) to do this?

I have created a small GUI for this.

It contains 4 text boxes - Path of Local file to be uploaded, IP address of remote machine, User name and password of remote machine At last there is one Transfer button when I click on this transfer button that file should get copied to the remote machine.


I tried this using FTPWebRequest class by reading example in msdn.

But to connect to remote machine it requires URI format of FTP and I only have IP address of that remote machine. I think there is no web server on that remote machine.

Should I need to install web server on that remote machine.

Or is there any other method to do upload files to remote machine ?


Remote monitoring and diagnostics for managed application


Please advice me...

I have a need to monitor (collect diagnostics) an application deployed, as a Windows Service, to over 40,000 (yes, forty thousand machines). Majority of the machines does not have standard tools like Visual Studio remote debugger, etc that are used for such purpose.

Also, I am not sure if WCF can be used as I am concerned about security - please enlighten me about pros and cons of having a WCF-Service-In-a-box approach. If so, what is the best binding.

Can WinRM be used to interact with a WCF NetPipe listening in the application? Any, article on this would be useful? What are the security aspects that should be focussed in this scenario.

Thanks in advance


SSIS FTP Task Variable Remote Path invalid


I am working on the SSIS FTP Task that transfer file from one FTP server to local location, rename the file name, and finally transfer the renamed file to another FTP server. So I defined 2 FTP tasks.

For the FTP file receive operation, I need the remote path to be updated by a script and pass to the user define variable. So I set TRUE to IsRemotePathVariable. In the RemoteVariable, I set User::FTPSourcePath where the variable is set in the script with "/DMFTP/filename1.jpg"

For the FTP file send operation, I set TRUE to IsRemotePathVariable. In the RemoteVariable, I set User::FTPDestPath where the variable is set in the script with "/DestFTP/"

After all the setting, the FTP Task box show me the error as "Variable "FTPSourcePath" doesn't start with "/". Another FTP box show me "Variable "FTPDestPath" doesn't start with "/"

Can anyone help me on this problem?? Thanks.

FTP task remote variable.


I am using the FTP task.

I have set remote variable to true and populated a variable with "/path".

I am now getting an error saying that the variable does not start with  "/".

This is driving me mad. I can not solve it!

Mr Shaw

The Application variable's value assignment in asp page not reflecting in .aspx page.


We are migrating ASP application into ASP.Net. We are migrating module by module.

In our application we are using Application variable in global.asax. like below, 

Application("ABC") = "Not Avail."

Application("DEF") = "Not Avail." 

One of the existing ASP page assigning the value for this Application variable like below,

Application("ABC") = "ABC"

Application("DEF") = "DEF" 

The newly assigned value for this Application variables only coming in .asp pages not in .aspx pages. 

Is there any limitation in Application variables like .asp code application assignment will not reflect in .aspx pages?

Save MVC Chat Room Data in Application variable or DB, where is better ?


My application is MVC Web App Chat Room , it supports following features:

1.Create/Join/Close room
2.Send message in room (just live message, offline message might be supported in future)

I have done logic for application, but I'm considering where to save chat room data (message,room information, and users in room) ? I see there are 2 options:

1. Application variable
2. Using file or database

-What if I saved in Application variable:
In case of there are 2000 rooms and 10000 users online, mean I have to persistence in Application variable (actually in RAM memory) information of 2000 rooms, more than 10000 message (text), these numbers might be increased by second if there are more users online in real time. and what's next ? I don't know what will happen to server, crash ? or my web app will be terminated ? whatever I don't want both results !

-What if I saved in file or DB (i.e: SQL Server DB)
Because of web application, clients have to send request every 1 second to fetch data (messages and user list in room). So in case of there are 2000 rooms and 10000 users online, means they will make 10000 requests every 1 second to DB. I don't know what will happen to DB, there are a lot of connections and in EVERY 1 second, can

How to connect to remote desktop from console application?



I'm trying to connect to remote desktop from console application without opening window using this code:

MsRdpClient7Class rdp = new MsRdpClient7Class();

rdp.Server = "";
rdp.UserName = @"username";
rdp.AdvancedSettings2.ClearTextPassword = "password";


But, there's an error message:

Error 1 Interop type 'MSTSCLib.MsRdpClient7Class' cannot be embedded. Use the applicable interface instead. C:\gtk\GetRemoteDesktop\ConsoleRemoteDesktop\Program.cs 16 7 ConsoleRemoteDesktop

How to accomplish it?

Thank you in advance.



Application variable or static class for global string?


I need to keep a global variable throughout the whole time the user is at my site, but do I use Application or a static class? The string variable should store a region name and my site makes a few changes depending on which region that has been set.

I read that Application was mainly for classic ASP, but I also read that a static class cannot be instantiated at runtime (e.g. when the user has logged in).

So, have I got something wrong here and which solution do I use?



Diff. b/w using object tag and application variable


What is the difference between using Static object collection (<object runat="server" scope="application" ID="MyInfo"   PROGID="MSWC.MYINFO">  </object> )  and using Apllivation variable (Application["Id"]=2;) to store application state. Are there any advantages and disadvantages in these two methods.

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