I tried posting this to the ASP.NET forum and got no response, so I'll try here. I will be developing some .NET C# GUIs that will use one or more web services to get and display information. The web services the GUIs use may need to do some things that require the security environment of a process running from the local hard disk, such as accessing the registry, creating a socket connection to a process on the local or a remote host, etc. All of this is not an issue if I develop the GUIs as C# applications. However, it occurred to me that there might be some advantage in creating them as user control libraries, where the controls are hosted in IE web pages (with the web page .html files and the DLLs containing the C# user control libraries installed locally on each client, not downloaded over the internet). My concern is that an article I have read (15 Seconds : Hosting .NET Windows Forms Controls in IE) indicates that if the hosted user controls access the web services and the web services try to do something like access the registry, create an event log, make a socket connection, etc., then they may fail due to security restrictions. Given that all the user control libraries are local to the machines running them hosted in IE, is there a simple way to set up security so that these controls (and the services they use) have permissions to do essentially the same things that a GUI program could do? I don't want to make the system vulnerable or upset system administrators, so if it isn't a simple and relatively safe thing to do, I'll just go with the native applications.
BambooMoon
Posts
-
Best option for IE hosted user control vs. stand-alone -
Fear of job changeI've spent most of the last 10 years doing C++/MFC and now C# development for the Windows platform. With all those years, one reaches a certain level of comfort and familiarity with all the arcane bits of trivia one must know to do Windows software development. I almost lose sight of the fact that this accumulated knowledge is INCREDIBLY Microsoft-specific. In fact, I know so much about Microsoft-related stuff and so little about anything else that it makes me wonder if I even exist outside of a Microsoft universe. Now I may have an opportunity to move to a new job at a new company I won't name, ranked one of the best companies to work for in the US, but doing C++ development for the UNIX platform. There is more than a bit of fear and apprehension about that. On the good side, I'd love to work for that company. Not only is it a good place to work, but it would be a fantastic team to be a part of, a great feeling of contribution, a great learning experience. But my accumulated "wisdom" would be pretty much useless and, even scarier, would gradually fade away into whatever place all unused brain synapses go. I'm not worried about being able to learn everything I would need for the new job. In fact, I suspect that there would be far less arcane knowledge required than in Microsoft-land. It's almost as if I have become so accustomed to, even brainwashed by, doing Windows software that it is like I'm turning to the dark force, knowing that the light will gradually fade away, and I'll be left standing naked in a strange UNIX universe. Well, maybe a bit of an exageration, but such a big change is certainly a leap of ... faith, courage, I'm not sure what. I'm wondering how other software engineers handled such big shifts in focus when changing from one job to another?
-
Conceptual QuestionThis is a common problem. The solution is simple. In one of the .h files, don't #include the header file of the other class. Instead just put a forward declaration. For example, in b.h, remove #include A.h and put "Class A;". Then in b.cpp put the #include a.h.
-
Web development book recommendation pleaseWhat book(s) would you recommend to someone who has decades of experience developing software, but zero experience and zero knowledge about any kind of software development related to the web? Obviously, if there were a specific area within web development of interest, you could recommend books in that area. But this is for someone who knows NOTHING about ANYTHING related to web development. Ideally, it would be nice to have a not-too-terribly-in-depth book that summarizes all the technologies involved in web development, plus other tutorial-like books on specific technologies. What would you recommend? Thanks.
-
Ideas on how to stream audio [modified]I have a receiver connected to the sound card of a computer through the Line In port. Currently, I have some old, unpleasant C++ code that captures the sound to a file locally. What I want to do now is to write some C# code instead that captures the sound off the sound card and uses probably UDP to send packets of the sound data to another computer, which will then play that streamed sound. I need some ideas of how to go about this, if anyone has any helpful suggestions. I would need to know: 1) How in C# to capture sound from the sound card on the system connected to the receiver. 2) How on the other machine to feed the incoming sound packets to ?? DirectSound or Windows Media Player ?? so that the user can hear it as it comes in. It is not really a constant stream of data, like a streamed radio station (though to be quite honest I don't know how streamed radio stations work either). The user on the second computer chooses which receiver-equipped-computer he wants to connect to in order to receive sound. I'm basically clueless on the two points above, so I would appreciate any suggestions. -- modified at 12:52 Friday 14th July, 2006
-
Transferring data from database to databaseI think you just double up the single quotes: Example: "INSERT INTO [Table] ([Field1]) VALUES ('This is a ''very'' large project.')
-
TCP questionYou are the best. Thanks.
-
TCP questionIf I have two processes connected via TCP (blocking), if one process writes data to the socket and then closes its end of the socket connection without any kind of handshake from the other process, will the other process still be able to read the data sent by the first process? Or will the data be thrown away when the first process closes the socket (in other words, is a handshake required)? In my situation, process A sends a large amount of data (perhaps a megabyte) and then needs to close to service other requests. Process B will always have a blocking read on the socket at the time that process A sends, but the read is specifically for a smaller number of bytes than the total number that process A sent. Process B has to read the header of the data to determine how long the rest of the message is, but by the time process B figures this out and posts another read, presumably process A will have closed its end of the socket. It appears to me that process B is always getting all the data, but I cannot find any documentation that says that this is the expected behavior. I don't want it just to be a coincidence.
-
Using RPC (with IDL) from C#I have several C++ server programs that were written to be accessed via RPC from C++ client programs, with interfaces defined in IDL files. Now, I want a client program to be in C# and to use the same interface. I found on the web some information about running midl to produce a tlb file and then running tlbimp to produce an assembly in a dll that I could presumably import into my C# program. But I'm stuck at square one. My IDL files never delcared a library XXX { ... }. They only declared an interface. Without a library declaration, no tlb output file gets produced. But if I blindly put "library XXX {" before the interface declaration in the IDL file and "}" at the end of it, midl then gives me a million error 2295 messages saying that "handle parameter or return type is not supported on a procedure in an [object] interface". Well, every one of my interface procedures has an int return type, and of course every one has an "[in] handle_t h" first argument (or else it would be unusable for RPC). What am I missing here? Thanks.
-
Send xy plot by emailI have a program that sends an email if a certain alarm condition arises. Currently, the email only contains a text message, but I'd like it also to include an xy plot of about 400 points. Trouble is, I don't know how to put that plot into an email. I know I could create an image in a file and attach that to the email, but I prefer not to do that. Is there some kind of html or something else that can go in an email that will display a plot given the set of xy points? I know that java classes on a web page can plot given the points, but can email clients like Outlook and Outlook Express run java applets? Any other thoughts? One thing someone suggested to me was to make a plot using ASCII codes. But my plot needs to be very precise for the points given, not some rough approximation, so I don't think that would work.
-
GetServices permissions error with Windows2003 SP1Rendili wrote:
Do you know if running as system would be able to access service information?
Yes, that is actually the preferred method.
-
C++ CTime to .NET DateTime>> Where did you find that strange bit of information It is not so strange if you analyze it. Those aren't "magical" numbers in that equation: DateTime.FromFileTime(10000000 * (long)timet + 116444736000000000) You can see from the method name that the quantity in parentheses is a FileTime. You already know that time_t is seconds since 1/1/1970. A FileTime is a long representing 100 nanosecond intervals since 1/1/1601. So all you need to do is multiply the time_t by 1e7 to get 100 nanosecond intervals, and then add the number of 100 nanosecond intervals between 1/1/1601 and 1/1/1970, which is easily calculated. Perfectly logical, no? Hahaha.
-
GetServices permissions error with Windows2003 SP1This is a very annoying security "enhancement" foisted upon you by SP1. We had the same issue. Fortunately, although our software might not be running as the administrator user, it does know the account and password of the administrator user. Given that, we check if the OS we are running on is Windows 2003 SP1. If so, we impersonate the administrator user and then run the following program. Sorry that the formatting is gone from the code below, but I don't know how to avoid that on code project.
// This program, which must be run as an Administrator, gives a specified non-Administrator user // start and stop capabilities on a specified service. It is intended to be run on systems like // Windows 2003 SP1 that restrict non-Administrator users from doing things with services. // Note that the changes to the services' ACLs only last as long as the service is installed. If // you uninstall and reinstall a service, you must rerun this program. // This program is a modified version of software provided by Microsoft at // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/modifying_the_dacl_for_a_service.asp #include #include #include #include void DisplayError(DWORD dwError, LPTSTR pszAPI) { char szMessageBuffer[2048]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), szMessageBuffer, sizeof(szMessageBuffer), NULL); // Display the string. _tprintf(TEXT("ERROR: API = %s.\n"), pszAPI); _tprintf(TEXT(" error code = %u.\n"), dwError); _tprintf(TEXT(" message = %s.\n"), szMessageBuffer); ExitProcess(dwError); } void _tmain(int argc, TCHAR *argv[]) { BOOL bDaclPresent = FALSE; BOOL bDaclDefaulted = FALSE; DWORD dwError = 0; DWORD dwSize = 0; EXPLICIT_ACCESS ea; PACL pacl = NULL; PACL pNewAcl = NULL; SC_HANDLE schManager = NULL; SC_HANDLE schService = NULL; SECURITY_DESCRIPTOR sd; // If you do not allocate some memory for psd before calling QueryServiceObjectSecurity(), you // will get a runtime error that you are using an uninitialized pointer. If you set it to NULL // instead, QueryServiceObjectSecurity() will return a NULL pointer error. The me
-
C++ CTime to .NET DateTimeYou say the value is saved in the file as an int32. Is it the same as time_t (which is 32 bits)? If so, the C# DateTime is obtained as follows, where the variable "timet" contains your 32 bit time_t value: DateTime.FromFileTime(10000000 * (long)timet + 116444736000000000)
-
Having a max line count in a list controlI have some applications that currently use a list control to display status messages from the process. As time goes by, the number of messages in the list would grow without bounds if I did not limit it. I do this by checking if adding a new message will make the line count go over the configured maximum. If so, I delete the first line in the control and then add my new line. There is no real need for the user to interact with the list other than to read it, possibly using the scroll bar. The list control has one column, wide enough for a reasonable length message. The difficulty with this is that it causes a lot of flashing of the control, whether or not I ensure that the newly added line is visible. If messages are rapidly being added to the list, the list can go completely blank for periods of time while tons of updating is going on. So what is a better way? I'm open to anything, particularly to using something other than a list control. Essentially, I'm trying to mimic how a read-only command prompt window works. Once it gets a certain number of lines in it, new lines cause old lines to disappear, with no annoying flicker. Thanks in advance.
-
Exceptionally dumb SQL Server questionThank you, Colin, that is exactly what I needed to know. Since I wanted a default instance of SQL Server 2005, I tried installing it and specifying that. It claimed that it would update my existing software (SQL Server 2000) and become the default instance, but it lied. Instead, it failed to install at all (or to rollback the installation). So after then uninstalling all versions of SQL Server from my machine, I could finally install SQL Server 2005 properly and it works without problems ...... except that I find that other machines, running SQL Server 2000, cannot go to Enterprise Manager and create a new server registration that connects them to my machine (even though I can create new server registrations in my SQL Server 2005 that connect me to their machines). Is it not possible for SQL Server 2000 installations to connect through Enterprise Manager to SQL Server 2005 installations? Or perhaps it is some security issue. The computer I'm using has had mysterious security problems since I got it. For example, mine is the only computer in the office to which nobody can map a shared drive, and nobody understands why not. -- modified at 14:27 Wednesday 5th April, 2006
-
Exceptionally dumb SQL Server questionOur many applications have always run with SQL Server 2000, which I have installed on my system, referencing a few databases. Now I want to test if the proper working of our programs will be affected by using SQL Server 2005 instead. I haven't yet installed SQL Server 2005. 1) When I install SQL Server 2005 (or for that matter, if I have multiple instances of SQL Server 2000 installed for some silly reason), I assume that each instance/verson of the product has its own list of databases, right? I mean, when I install SQL Server 2005, I assume that I cannot attach the exact same databases that SQL Server 2000 already has attached? 2) If I run a program using OLEDB (C++ code) or ADO.NET (C# code) that wants to access a database, how on earth does it know which instance/version of SQL Server contains the database? I would have thought it was through the connection string, but the connection string I have always used doesn't seem to specify anything that would identify a particular instance/version of SQL Server: Provider=SQLOLEDB;Data Source=;Persist Security Info=True;User ID=;Initial Catalog=;Password= Thanks for the help. I'd rather know this before I install SQL Server 2005. -- modified at 10:55 Wednesday 5th April, 2006 Hmmm. Those smiley's you see are code project misinterpreting my angle brackets. I don't actually put smileys in my connection string :laugh:
-
C# VS.2005 application deployment helpEd.Poore wrote:
I think this is your problem
You are wrong:):):) As it turns out, this is documented in http://www.codeproject.com/cpp/vcredists_x86.asp[^]
-
VS.2005 C# app deployment help neededThanks for the good idea. Unfortunately, mine aren't COM based. But I've discovered that at least part of my problem is the C++ runtime used by the wrapped classes. I need to get vcredist_x86.exe from Microsoft and install it. That got things running completely on one of the four machines where they weren't working. The other 3 still don't work. But I've opened a support incident with Microsoft, so perhaps on Monday I'll know why.
-
C# VS.2005 application deployment helpI have tried to put my C# applications and DLLs developed with VS.2005, including some C# DLLs that wrap legacy C++ DLLs (via Managed C++), on a computer that has no development environment. I thought if that computer had .NET 2.0 (and I am using some .NET 2.0-only components), my applications would run. They do not. They run fine on my development machine, but when I run the exact same executables on the exact same USB drive on another machine, they either fail to load (FileNotFoundException, but of course it doesn't tell you what file was not found), or they load but fail to work (unable to create TCPListener socket). Since there is no difference in the bits or in the directory, that leaves the path, as far as I can think. But apart from the VS.2005 development directories, the only path differences are to windows or winnt's system32 directory. So what does one need on a Windows 2000 or XP machine, both of which have ALL service packs and updates and both of which have just had .NET 2.0 installed on them, to get programs to run properly? Any help would be greatly appreciated. I have NOT made a deployment project of any kind and don't see why I should have to. I have just move the bits, including all dependencies from one machine to another.