Hi, I am developing an application that calls a WCF service which connects to a remote server and downloads a file. The remote server returns a Stream object for each download request. Is it possible to return the stream from the WCF service to the client? Pls advice. Thanks, ramz_g
ramz_g
Posts
-
Returning stream from a WCF Service to the client -
Windows Identity of the currently logged in userHi Eddy, Thanks a lot for the replies..
Eddy Vluggen wrote:
The simplest way would be to create a small application that writes the username to a file, and to drop it in the Startup-folder.
I shall use this... Thanks, ramz_g
-
Windows Identity of the currently logged in userHi Eddy, Thanks a lot for your reply..
Eddy Vluggen wrote:
It would be a breach in security if you could impersonate that user without them entering a password for their account.
Yes I understand that.
Eddy Vluggen wrote:
If you're using SQL Server, then you might want to switch to a SQL-login
No, I'm not using SQL Server. All I'm using is a simple Sqlite database and I'm using simple queries where I have to use the windows logged-in user name. So, is there any way that I can obtain the logged in user name alone? Thanks, ramz_g
-
Windows Identity of the currently logged in userHi stancrm, Thanks for your reply.. But I have tried
Environment.UserName
already but it doesn't help, maybe because my service is running at the System level and the environment here is the System and not the user. Also, I would like to know whether there is any class that actually returns me the Windows Identity object of a specified user. Thanks, ramz_g -
Windows Identity of the currently logged in userHi, I have created an application which runs on a Web Server. This web server in-turn runs as a windows service. This windows service's account is configured as follows
ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
Now I have a scenario in which I have to access a database and execute queries in it which needs the currently logged in user. The problem is that whenever I try to use
System.Security.Principal.WindowsIdentity.GetCurrent().Name
I am getting the name as "SYSTEM" and not the logged in user's name. And I know that this is because the service is run at the system level. I can change the ServiceAccount as
serviceProcessInstaller.Account = ServiceAccount.User
I can now get the currently logged in user name. But, this requires the user to enter his user name and password when the service is being installed and I do not want that to happen. Hence is there any other way in which I can get the WindowsIdentity object of the currently logged in user? Please suggest.. Thanks, ramz_g
-
Is it safe to use Process.GetCurrentProcess().Kill() ?Hi All, Thanks for all your replies... @Nagy Vilmos, Yes Nagy, I did think about what could be running.. It is just that I was not able to find what was running.. Debugging? Of course.. Anyways, thanks for your reply...
-
Is it safe to use Process.GetCurrentProcess().Kill() ?Hi, I have developed an application in C# .Net... My requirement is that the application should clean up all the resources that it used and exit when I click on the "Exit" option that I have provided.. But sometimes, when I try to exit the application using "Application.Exit()", the application fails to exit and continues to be listed on the Windows processes in the task manager. I would like to know if I can use Process.GetCurrentProcess().Kill() instead of Application.Exit(). If not, please suggest on what I can do to have the application exit when I want it to... Thanks, ramz_g
-
Accessing the right Registry entry for Internet Explorer in C#Hi, I am working on a small application that checks what browsers are installed on a system running Windows Xp... I was able to find the right entries to check whether Firefox and Chrome are installed or not... And after quite some amount of googling about IE, I found that IE might get corrupted due to some unforeseen reasons... So, is there a possibility of a windows system to have NO internet explorer installed? If yes, How can I check whether IE is present or not.. Please suggest... Thanks in Advance
-
How to use a GridView in a ListView - C# WinFormsHi Henry, Thanks for your reply. Using the DataGridView was always one the options that I had. Maybe its time that I zeroed-in on using the DataGridView... Thanks, ramz_g
-
How to use a GridView in a ListView - C# WinFormsHi Dave, Thanks a lot for your reply.. I have already analyzed the example project that you had posted a link to.. It doesn't suit my requirement because the example loops through a table and updates the ListView. That is exactly what I'm doing right now, just that I do not use a table but I iterate using a list of objects. But my case is that I add a huge number of items to the ListView at a moment, probably in the range of a few 1000's. That time, the performance of the ListView is not very pleasing. So, a pure DataBinding concept, as in the case of a DataGridView would be really helpful. I was told that a GridView in a ListView might serve this cause. Any opinions on this would be really helpful. Thanks in Advance, ramz_g
-
How to use a GridView in a ListView - C# WinFormsHi, I am working on a project where I have used a ListView to add and clear items. However, due to frequent adding and deleting, the ListView is being hard to maintain. So I thought of binding items to the ListView. Since it is not possible to bind an object to a ListView straight away, I was advised to use a GridView in a ListView and bind items to the GridView. I googled it to some extent, but I couldn't find an apt match. Can anyone post a link which might explain me what to do to use a bound GridView in a ListView? I'm using WinForms, not WPF... Thanks in Advance, ramz_g
-
creating a directory in the solution during runtimeHi, You can maintain your solution path in a configuration file, namely App.Config.. Have a class that reads the xml file and get the path assigned to a property.. U can then use this property in your code wherever you wish to use the solution's path... Hope this helps... :)
-
Highlighting Text in Powerpoint 2007 [modified]Hi, I was just trying to do some coding on highlighting a portion of text in Powerpoint so that I could insert a hyperlink to it. I could achieve it without any difficulty in Powerpoint 2003 and to my surprise, it did not work in Powerpoint 2007... The code that i used is as follows : ((PowerPoint.Application)applicationObject).ActiveWindow.Selection.TextRange.Text = "PPT"; ((PowerPoint.Application)applicationObject).ActiveWindow.Selection.TextRange.Select(); ((PowerPoint.Application)applicationObject).ActiveWindow.Selection.TextRange.ActionSettings[Microsoft.Office.Interop.PowerPoint.PpMouseActivation.ppMouseClick].Hyperlink.Address = "http://www.google.com"; ((PowerPoint.Application)applicationObject).ActiveWindow.Selection.Unselect(); Can anyone tell me what could have gone wrong in the above code?
modified on Monday, May 11, 2009 7:10 AM
-
Deploying custom fonts at Client PlaceHi All, Thanks a lot for the suggestions... Thanks, ramz_g
-
Deploying custom fonts at Client PlaceHi Eddy, Thanks for the reply... But I think you misunderstood my question... Suppose my client's system does not have a font style named "xyz" which I used in my application. I asked how to embed the font in my application and deploy the application on my client's system so that he sees the same font styles that I used while developing the application.
-
Deploying custom fonts at Client PlaceHi, I've developed an application that uses a few font styles that might not be present in all machines... How can I embed these fonts when I deploy my application at the Client's system, assuming that his system does not have those fonts installed... Please suggest... Thanks in Advance, ramz_g
-
problem with keypress functionHi, You can override the ProcessCmdKey() function in Control class like this : protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Alt | Keys.F4)) { //Your Code } return base.ProcessCmdKey(ref msg, keyData); } Hope this helps, ramz_g :-)
-
Issue with the GzipStream ClassHi Rolcr, :-) Ya.. Even i browsed through all these sites earlier today and found that there are some issues with GZipStream... Anyways, thanks for the replies... ramz_g
-
Issue with the GzipStream ClassHi Rolcr, Thanks for the reply. And yes, I could understand that using those classes to compress files that are already compressed may increase the size. But there is something interesting. I downloaded the gzip.exe from GNU's website and used it to compress a few files. I could find that the size of an exe file reduced by about 5mb... Whereas, using the above classes, the size of the same file increased by more than 30mb. Also, both (gzip.exe and the GZipStream class) returned similar results when applied to .txt and .doc files. Please give me your opinion on this. Thanks, ramz_g
-
Issue with the GzipStream ClassHi, I am trying to include a compression mechanism in my application. I just went through the one that microsoft provides : GZipStream class... I used the sample code given in msdn and tried to compress files... It worked well for text and document files... But when i tried to compress an exe file, say 100mb size, the compressed file that i get is of size more than 130mb... Can anyone please tell me whether this is a problem with the GZipStream Class? Thanks in advance, ramz_g