|
Do it how other sites do it with ActiveX controls - if you can't instantiate it, redirect to a download page. There really is not provided method for determining if an application is installed from a web page. System components (like the CLR) will typically add a versioned identifier to the UserAgent string, but it every control did this the UserAgent string would be huge.
The delivery is what's important, though. Is your smart client distributed over the Internet using touchless deployment? If the user does not have the appropriate permissions to execute the assembly, it will not load. GotDotNet[^] does it this way. The only installation needed merely installs a CodeGroup into the machine policy.
If your smart client is actually installed onto the user's hard drive, it must be scriptable otherwise you won't have a way of determining whether or not its installed since you can't instantiate it.
Read Exposing .NET Framework Components to COM[^], as well as an older article I wrote, User Controls for Windows and the Web[^], for more details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
See that's what I thought, however, I've code signed the ocx, and Windows XP SP2 still brings up that stupid bar at the top indicating that there's unsafe code trying to run in the browser? Any way around that? There MUST be.
|
|
|
|
|
This has absolutely nothing to do with OCX's, which are (typically) compiled VB projects with a modified PE/COFF header that relocates the entry point to msvbvm60.dll (or whichever VB VM is applicable).
If you read my old article and the link to MSDN I gave you, you will see that you simply drop the assembly in a virtual path and reference the assembly and type (separated by #) in an OBJECT tag. You can sign it with an authenticode certificate if you like, but it's not required (just a CodeGroup in the appropriate policy that allows execution of your code, depending on what permissions your code requires, i.e. FileIOPermission , etc.).
If you want to know about the changes made by XP SP2 and how to prepare for it, as with everything related to Microsoft development go to http://msdn.microsoft.com[^].
A quick search yields Description of the Internet Explorer Information Bar in Windows XP SP2[^].
Even without searching, though, realize that there is no way to get around it from a content author. What would be the point of having any security, then? Signing it simply improves the information presented to the user so it can be installed. This really is no different from before, just a little more instinctive for the users, the majority of which simply click "Yes" or "OK" to any prompt they're given (there's user studies to back this up).
Again, though, no OCX is required. If you deploy your smart client using touchless deployment (described in more detail at http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondeployingcommonlanguageruntimeapplicationusingie55.asp[^]).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I know what you're saying with the touchless deployment, however I cannot do this because of the fact that I am embedding the Windows Media player within the app itself and the security sandbox won't allow for the dynamic winforms. I've had this discussion with Mark Boulter who actually created the concept. Unless you're him?
So the security sandbox will NOT let me deploy my app this way. However, it must be possible since there are many objects that can be instantiated within IE without that security bar popping up.???
I really really appreciate your help here.
I should also add that there are other things that won't let me deploy in the touchless manner such as odd shaped forms without the borders,... etc. In other words, it's not just the media player.
|
|
|
|
|
If you read the linked page, it states that ActiveX controls that are yet installed will invoke the information bar.
No, I'm not Mark but I was using and helping to develop touchless deployment long before most even heard of it. I was previously a software architect that designed a massive N-tier application that utilizes this technology and, with the help of several others, pushed that in .NET 1.1 some rights are granted to the Internet zone - enough to at least load a loader assembly (which GotDotNet does, IIRC, to demand the rest of the permissions in a nice little scripted runtime), as well as a way to pass cookie data through IEExec (although I had a better way that they've never implemented, nor will they probably ever).
So, you're saying that you're containing an AxHost to embed WMP in your Windows Forms application? We (speaking on behalf of my former employer before I came here) successfully did it using a touchless deployment scenario for Windows Forms and embedded the WebBrowser control just fine. Or are you saying that you're embedding the WMP control in IE, which hosts a Windows Forms control?
Sorry, I'm just a little confused about your scenario.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Not embedded within IE control which is in a winforms control, no. The mediaplayer is hosted just within the app. But remember, due to the nature of the transparency of the borders, etc. (odd shaped windows form), THAT portion cannot operate as touchless deployment either (or as Mark always called it "dynamic winforms").
Although I would like to see how you got the AxHosted media control through the security? That would be interesting to review.
Aside from this though, you wrote this
"If you read the linked page, it states that ActiveX controls that are yet installed will invoke the information bar."
What do you mean by those that are 'yet installed'?
- Also very funny: I'm a former MS employee myself. 
|
|
|
|
|
I don't have access to that code anymore (I no longer work for that company), but since our application was so large and required just about every permission I created an installer that added a code group (using a UrlMembershipCondition ) that required the FullTrust permission set. Hosting the WebBrowser control was no different than hosting it in a locally launched Windows Forms application.
"Yet" installed means the ActiveX control (and related libs, etc.) haven't been installed yet. I.e., you install a fresh copy of Windows. You don't have QuickTime (I'd love to go without that resource hog, but unfortunately can't due to people actually distro'ing QT content!), Flash, etc. When you go to a page that requires them (assuming they have the right codebase), you'll get the bar in IE (with XP SP2). They haven't been installed yet.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Well, I do now have the activeX control showing the picture on the webpage without a warning, HOWEVER, if I script ANYTHING to it (even just getting a true / false property value) it triggers the stupid SP2 stuff.
So here's my question: CAN I through javascript detect if this object exists? I know I can do a Javascript attempt such as
var myClient = new ActiveXObject("Project.ClassName");
within a try catch, however even though this OCX is SIGNED, it says that it cannot create the object? Although putting the OBJECT tag with the classid shows up just fine.
Is this more SP2 B.S.?
|
|
|
|
|
You have to mark your ActiveX control "safe for scripting". This really isn't anything new in XP SP2, though. IE always acted this way when scripting ActiveX controls, but reacts a little different now (i.e., how it interacts with the user). I suggest reading about IE security zones and settings in MSDN Library.
Most of this comes down to the user's security settings. You can't get around them (knock on wood), otherwise what's the point of security? You have to work within them and utilize what you can.
If you want to use javascript to see if an object exists, there's always typeof you can use like so:
if (typeof("myControl") == "object") window.alert("It exists!"); The fact that your ActiveX control is signed will 1) dictate what the user sees and how confident they should be (a nicer UI for signed components), and 2) the different security zone settings for signed and unsigned components, as well as signed and unsigned .NET Components (when the .NET Framework is installed).
I also urge you to explore the security zones settings if you haven't already. Be sure to set them all to default (click the "Default" button after selecting each one) at first to get a glimpse of what you're dealing with.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I coding one programm:
private void button1_Click(object sender, System.EventArgs e)
{
thread = new Thread(new ThreadStart(ThreadFunc));
thread.Start();
}
public void ThreadFunc()
{
try
{
tcpListener = new TcpListener(IPAddress.Any, 8080) ;
tcpListener.Start ( ) ;
while (bConnect)
{
if (tcpListener != null)
{
m_socket = tcpListener.AcceptSocket();
if(m_socket.Connected)
{
Thread thread1 =new Thread(new ThreadStart(Receive));
thread1.Start();
}
}
}
}
catch(Exception exp)
{
MessageBox.Show(exp.Message);
}
}
protected void Receive()
{
int iRead = 0;
byte[] bts = new byte[1024];
while (true)
{
iRead = m_socket.Receive(bts);
if (iRead == 0) break;
byte[] btRead = new byte[iRead];
Array.Copy(bts, 0, btRead, 0, iRead);
string sTemp = Encoding.Default.GetString(btRead);
listBox1.Items.Add(sTemp);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.bConnect = false;
}
private void button3_Click(object sender, System.EventArgs e)
{
DoSomething();
}
I want to dosomething when click button3. It can stop the listener, and exit the thread. but I get a same result, the programm can't close normally.
|
|
|
|
|
|
Hello,
i am interesting in your code sample. Can you please explain me what your code sample does??
thx
regards
mat
|
|
|
|
|
I do a socket server, When I click button1 then throw one thread that it listen host port. If some data receive from remote host, then throw another thread that receive data. If I click button2, I want to close port and stop the listen thread , but I find it always fail.
yesterday, I found out If want to stop the listen port and thread, when I click the close button, send some data to server port then it can close normally.
But I want to know one better method.
|
|
|
|
|
For what reason do you develope this??
|
|
|
|
|
I need do a monitor programm that receieve all communications from client host with socket.
|
|
|
|
|
does anyone know how to convert symbols into their equivalent numeric character reference using c#, without using the search and replace function ?
i.e COPYRIGHT SIGN into © ?
|
|
|
|
|
hi
i have service which reports to a web service in the server whenever it starts. but the service is not starting for some reason i am not able to figure out what the problem is the exception i am getting is as follows
Service cannot be started. System.TypeInitializationException: The type initializer for "System.Management.ManagementPath" threw an exception. ---> System.TypeInitializationException: The type initializer for "System.Management.MTAHelper" threw an exception. ---> System.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.
--- End of inner exception stack trace ---
at System.Management.MTAHelper.CreateInMTA(Type type)
at System.Management.ManagementPath.CreateWbemPath(String path)
at System.Management.ManagementPath..ctor(String path)
at System.Management.ManagementPath..cctor()
Can anyone explain me what the problem and whats the solution for this
thanks!
deepak
|
|
|
|
|
Hi!
I just wanted to ask about the dlls that we add to the application folder using the setup projects, are they registered on installation and if yes why. The reason that i ask this is that my project required mfc70.dll for it to work, i added mfc70.dll in the application folder and now when i install the application using the installer, there is an error saying:
"Module C:\......\mfc70.dll failed to register HRESULT -2147024769 Contact your support personnel" and it gives me 3 options, "Exit installation", "try again" or "continue."
Please help me out here.
Thanks.
|
|
|
|
|
hi,
try to add through the reference folder which is avilable in your application.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Please clarify what do u mean by the reference folder, do u mean the folder which is present along with the installer while building from which installer program picks up the files and creates the MSI. If yes, then i did add the dlls from that folder, actually all other dlls work fine, its just a problem with mfc70.dll.
Thanks for the prompt reply.
|
|
|
|
|
hi,
tell me how u are adding mfc70.dll file in your application.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I add all the files, whether dlls or other files to a folder named "Application" and keep it in the same directory as the setup project. Then in the setup project, i add the files to the application folder, by right clicking on the Application Folder->Add->File and then browse to the Application folder and add the mfc70.dll and other files from there. Am i doing something wrong? I have also made a hierarchy of folders inside application folder, and i add the files to the folders with the same method.
Thanks for your response.
|
|
|
|
|
hi,
ya ya i got everything. Forget about application folder in your setup program. What i am asking is How did you add that .dll file in your project(source project(solution)).
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi,
don't feel bad sure i will help you out.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
i just copied the file from the c:\winnt\system32 folder into my project
|
|
|
|
|