|
A few days ago I described a problem of Managed extensions with System.Security.Policy.PolicyException. Nishant Sivakumar suggested I try Adding Assemblies to Security Policy, which was a good idea. Unfortunately, up until now, I haven’t been able to make it fly. In this page there is a sentence “Before you add an assembly to security policy, you must give it a strong name and put it in the global assembly cache.” I haven’t exactly understood how to give my program a strong name and put it into the global assembly cache. When I tried according to the example on the same page, it didn’t work.
I see that the basic idea was sound since turning off security by “caspol –s off” made the program begin to work over the LAN. Turning off security isn’t exactly a great idea, so I turned it back on again.
I looked at the neighboring pages and it talks about reasonable things like System.Data.SqlClient.SqlClientPermission, which I in fact use. It doesn’t list individual programs, like I have built.
I decided to do an experiment. I took another program which I wrote, which doesn’t use managed extensions and tried to run it from the same “temp” directory, which I shared as z:\temp. It worked both from the local disk, temp, and from the LAN z:\temp. I then recompiled it using Managed Extensions. Clearly it was using absolutely nothing from managed extensions, but was just compiled using the option. Now it worked on the local computer but failed the same way on the LAN.
This implies that EVERY program which uses managed extensions in even the most trivial way will have problems. This seems to me to be absolutely crazy. How can anyone get any work done? There has to be a more general solution. Maybe it is a problem of version numbers between my Visual Studio 2003 and my latest version of XP?
Any suggestions would be welcome.
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: Turning off security isn’t exactly a great idea, so I turned it back on again
Good, turning off the security is a really bad idea.
Why do you want to run it from the LAN?
If you try and update the binaries and a user has them launched from the network you won’t be able to. Consider the advice from my previous post.
Your Network admins will thank you...
|
|
|
|
|
Turning off security was just a method to prove where the problem is.
I already bought your idea from the previous post. When you suggested it for the compiled help, I immediately realized it would work here as well.
The original idea of running from the network was to guarantee that all users are using the same software, but the intelligent download works just as well (or even better from a bandwidth point of view).
|
|
|
|
|
IlanTal wrote: I already bought your idea from the previous post. When you suggested it for the compiled help, I immediately realized it would work here as well.
Simplicity.
|
|
|
|
|
IlanTal wrote: This implies that EVERY program which uses managed extensions in even the most trivial way will have problems. This seems to me to be absolutely crazy. How can anyone get any work done? There has to be a more general solution. Maybe it is a problem of version numbers between my Visual Studio 2003 and my latest version of XP?
I believe this is part of the .NET security model. Dig into that, in the end you will find it more preferable to deploy locally.
|
|
|
|
|
The simplicity of your suggestion of deploying locally means that I don't have to bother with the .NET security bag of worms. As they say "KISS" - keep it simple, stupid.
|
|
|
|
|
IlanTal wrote: As they say "KISS" - keep it simple, stupid.
That's Signature material there!
|
|
|
|
|
A few days ago I described a problem I had with a compiled help which ran with no problem on the local drive, but not when it was on a network drive. Nishant Sivakumar suggested it might be broken links. To test the problem I shared out a directory called “temp” on my local drive. I shared it as z:\temp. Then I put a help file, cardiac.chm which had links ONLY to existing files (i.e. no Web pages). These existing files have been compiled into the cardiac.chm file.
On the temp directory the help file worked as expected. On z:\temp it told me “Internet Explorer was unable to link to the Web page you requested”. Since all links are to internal existing files (in the help itself), there should be no broken links.
Still I don’t know what to do to fix the problem. I also tried several compiled help files and they all show the same problem. Something is different about a network drive which causes the help not to work.
Any suggestions would be appreciated.
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: Still I don’t know what to do to fix the problem.
Rest assured that the problem you’re experiencing isn’t something to do with your compiled help file. I haven’t found anything to prove this yet but I think breaking the chm file is done for security reasons (ie when not run from the local machine). I had a help file shared as well worked fine until a few months ago; then it failed to work (me thinks there was a MS update involved). I just set up my app to check the help file on the local drive against a version on the network if the network version is newer update then copy the new version up.
On a related note attempting to compile a help file on the network also fails as well.
-- modified at 2:29 Wednesday 25th January, 2006
|
|
|
|
|
You found an interesting solution in the app to check dates and download the latest version from the network. This would of course solve my problem both for the managed exe as well as the compiled help.
Both should really work from the network drive, but if they don't work around the problem by downloading the latest software from the network drive. I hadn't thought of that possibility.
Since you have already thought about the problem, do you use a bat file or did you write an exe to do the job?
Thanks,
Ilan
|
|
|
|
|
The batch file is very simple / good idea. And could be something as simple as
XCopy –d [Network path] [Local path]
The –d switch indicates to copy if the file is newer.
Type help xcopy in at the command prompt for a full list of options
First off when I responded to your question I guess I didn’t realize this was the managed forum so bear with me as there is probably a better way in Managed code
It’s really easy, I have an ini file that specifies where on the network my stuff sits. I do this from the splash screen (hey what else is it for).
->Get the path to my chm file
->Get the date modified.
CFile::GetStatus [^]
->Get the Date modified of the local file.
->Compare the two.
->Copy the files if the network one is newer.
CopyFile[^]
-- modified at 3:38 Wednesday 25th January, 2006
|
|
|
|
|
I'll use your idea of the batch file. Up until now it has been a real problem since people have to manually update to the latest file (since the LAN doesn't work) and of course they don't update.
If you have time, please look at my troubles with managed files. It is the message immediately above this one. I'd like to hear your thoughts on it.
Thanks,
Ilan
|
|
|
|
|
Why not create a small second program point all users links to it, this second app could do all of the updating then start the main application. Sounds like the easiest solution to the problems.
I don't know anything (at this point) about managed extensions. Which is hear nor there really for the problems your having, I have always felt apps should be run locally unless its on a very small LAN, why use any more network bandwidth than you absolutely need?
|
|
|
|
|
The problem which I don't know how to solve with your suggestion is that I don't know what directory is used for my application. However, if I put the second app in the target directory I would know to load to that directory on the local drive.
I agree about not eating up network bandwidth and an addtional advantage here would be it wouldn't eat up much just to get the time stamp each time, with an occasional download when necessary.
|
|
|
|
|
IlanTal wrote: I don't know what directory is used for my application.
// Vars //
char szAppPath[MAX_PATH] = "";
CString strAppDirectory;
// Get the path to the running application //
::GetModuleFileName(0, szAppPath, sizeof(szAppPath) - 1);
// Extract directory
strAppDirectory = szAppPath;
strAppDirectory = strAppDirectory.Left(strAppDirectory.ReverseFind('\\\'));
GetModuleFileName[^]
IlanTal wrote: I put the second app in the target directory I would know to load to that directory on the local drive.
If I understand the question correctly your uncertain about how it all should be set up.
In the same directory put these files.
\Laucher.exe (does the updating and lanches the myapp.exe)
\MyApp.exe (Your real application)
\MyHelp.chm (Your help file)
\MySettings.ini (Settings, where on the network are your binaries located, cause those pesky network admins change directories occasionally)
|
|
|
|
|
I think we are saying the same thing but don't realize it.
I understood your suggestion to be an app ON THE NETWORK DRIVE. My reply was I know what to do if the app is on a local drive, but I don't know the local drive, directory if the launching app is on the network drive.
I think I basically misunderstood you when I thought you meant it to be on the network drive.
|
|
|
|
|
IlanTal wrote: if the launching app is on the network drive
Put the launching app on the local PC, that way it has full access to the local machine.
IlanTal wrote: I think I basically misunderstood you when I thought you meant it to be on the network drive.
Sorry about any confusion, hope it's cleared up now.
|
|
|
|
|
Thanks for all your comments.
It just goes to show that sometimes the solution comes from an unexpected direction.
|
|
|
|
|
IlanTal wrote: Thanks for all your comments.
Your welcome.
:->
IlanTal wrote: It just goes to show that sometimes the solution comes from an unexpected direction.
I don't normally troll the C++/CLI board. Just by chance I saw the post for help with a help file. Having spent my fair time scratching my head over issues dealing with chm files I thought I would take a look.
It's always to help others...
|
|
|
|
|
How to convert DWord to int?
|
|
|
|
|
This is a C++ question so you should post it in the Visual C++ forum. This forum is for managed.
Anyway for your question, just cast it:
int iValue = (int)dwValue;
And even the cast operator is not required.
|
|
|
|
|
I am using ADOX (At least i want to)
I have found serval sites on examples. But i can't make it work.
How can i use ADOX to open database? ADOX is COM object. Can i have an example?
I need this in C++/CLI.
Second question: Where can i find any tutorial on ADOX in C++/CLI, MC++, VB.NET or C#. Using .NET framework 1.0, 1.1 or 2.0. I can esaly convert from one to C++/CLI if they are using .NET framework. (Only syntax is diffrent)
Thanks in advance.
|
|
|
|
|
Hi
I am writing a console program. I want to put it on my website, and I need people to connect VIA telnet. I have no idea how to use anything with telnet. I am writing this program using C++, and for beginning, I just want the ability to chat through my program VIA telnet, then I can easily go from there. Please help me out. Thnx
|
|
|
|
|
I'd suggest that you should ask this in the visual C++ forum, unless you're using C++/CLI ( managed C++ ). I have to admit, the .net framework probably offers a lot of support in this area.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm using Visual Studio 2003 for an MFC project, and every once and a while (more frequently lately) some of my menu IDs convert from the ID representation (e.g. "ID_FILE_HELLO_WORLD" to the number (e.g. "20412").
Has anyone else seen this bug, and if so, how can I avoid it? It's driving me nuts!
Warren
|
|
|
|