使用winforms控件作为Internet Explorer中的对象的问题 [英] Problems using a winforms control as an object in Internet Explorer

查看:97
本文介绍了使用winforms控件作为Internet Explorer中的对象的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这不适合这个小组,但问题与我正在进行的

asp.net项目有关。


我正在尝试开发一个Windows窗体控件,以便在IE中使用

内部网解决方案。

控件列出附加到特定项目的文档。控件支持

拖放,并通过Web服务自动上传和下载到

SQL服务器数据库。


控制在我的开发机器上运行时工作正常。但是,如果我试图从另一台计算机上请求我的开发机器上的页面我无法获得它

上班。


我知道从使用ActiveX时你必须输入一个Codebase。指向

Active X控制CAB应该下载并安装ActiveX

控件。

如何使用Windows窗体修复此问题控制?


所有客户都安装了.Net Framework。


这是我的对象标签


< OBJECT id =" oFile1"

classid =" http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>

< / OBJECT>

祝你好运

John Boghossian

I know this isn′t spot on for this group, but the problem relates to an
asp.net project i am working on.

I am trying to develop an windows forms control to be used in IE in an
intranet solution. The
control lists documents attached to an specific item. The control supports
drag/drop and automatically uploads and downloads via an web service to an
SQL server database.

The control works fine when run on my develop machine. But if i try to
request the page on my develop machine from another computer i can′t get it
to work.

I know from when using ActiveX you have to enter a "Codebase" to point to
the Active X controls CAB that should download and install the ActiveX
control.
How do i fix this with an windows forms Control?

All clients have .Net Framework installed.

Here is a my Object Tag

<OBJECT id="oFile1"
classid="http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>
</OBJECT>
Best regards
John Boghossian

推荐答案

您实际上需要在浏览器中托管Windows控件。我不确定

你怎么说应用程序正在运行。我得看一些代码。在

其间,google for jeff prosise and hosting。他有一篇很好的文章

,它讲授如何在浏览器中托管Windows控件。有很多

COM等所以它有点在前进方面。我相信代码库

属性是被删除的,IE足够聪明,知道需要什么。

程序集在bin文件夹中 - ! 100%肯定。


-

问候,

Alvin Bruney

得到花絮?在此处获取...
http://tinyurl.com/3he3b

" John Boghossian" <乔************* @ investorab.com>在消息中写道

news:uG ************** @ TK2MSFTNGP12.phx.gbl ...
You''d actually need to host the windows control in the browser. I''m not sure
how you said the application is working. I''d have to see some code. In the
meantime, google for jeff prosise and hosting. He has an excellent article
which teaches how to host a windows control in a browser. There is a lot of
COM etc so it is a bit on the advance side. I believe the code base
attribute is depricated and IE is smart enough to know what is needed once
the assembly is in the bin folder - ! 100% sure.

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"John Boghossian" <jo*************@investorab.com> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
我知道这不是'这个组的问题,但问题与我正在研究的一个asp.net项目有关。

我正在尝试开发一个Windows窗体控件,用于IE中的一个
内联网解决方案。
控件列出附加到特定项目的文档。控件支持拖放,并通过Web服务自动上传和下载到SQL服务器数据库。

控件在我的开发机器上运行时工作正常。但是,如果我尝试从另一台计算机上请求我的开发机器上的页面我无法获得
它的工作。

我知道从使用ActiveX时你必须输入代码库指向Active X控制CAB应该下载并安装ActiveX
控件。
如何使用Windows窗体控件解决这个问题?

所有客户端已安装.Net Framework。

这是我的对象标签

< OBJECT id =" oFile1"
classid =" http:FileUpload.dll #FileUpload.FileUpload Control" VIEWASTEXT>
< / OBJECT>

最好的问候
John Boghossian
I know this isn′t spot on for this group, but the problem relates to an
asp.net project i am working on.

I am trying to develop an windows forms control to be used in IE in an
intranet solution. The
control lists documents attached to an specific item. The control supports
drag/drop and automatically uploads and downloads via an web service to an
SQL server database.

The control works fine when run on my develop machine. But if i try to
request the page on my develop machine from another computer i can′t get it to work.

I know from when using ActiveX you have to enter a "Codebase" to point to
the Active X controls CAB that should download and install the ActiveX
control.
How do i fix this with an windows forms Control?

All clients have .Net Framework installed.

Here is a my Object Tag

<OBJECT id="oFile1"
classid="http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>
</OBJECT>
Best regards
John Boghossian



嗨John,

感谢您使用MSDN新闻组!我的名字是Steven,我会在这个问题上帮助你。

根据你的描述,你已经制作了一个Winform控件并在一个web

页面显示在IE中。此外,它在开发机器上运行良好。但是,当你从其他机器访问页面时,你发现控件没有工作。

如果有什么我的话误解,请随时告诉我。


因为您提供了代码期限:

< OBJECT id =" oFile1"

classid =" http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>

< / OBJECT>


指定程序集的路径与页面的位置相同,并且

控制可以从本地机器很好地显示。所以我不认为

问题是由程序集的路径引起的。另外,我想在这个问题上确认



1.所有测试机都是基于内联网的环境,是吗?所有人都安装了相同版本的dotnet框架吗?

(至少有相同的最高版本?)


2 .FileUpload.dll与

包含它的页面放在同一个directoy中?如果是这样,组件的位置就不会有问题。


3.当从其他客户端机器请求某个页面时,
$是什么b $ b页面显示控件,因为它可以工作。如果它是一个大矩形

,带有一个小矩形(在左上角),还有一个X。在小的

矩形中,表示控件的装配不能正确地位于
。另外,如果在小矩形中,有一些迷你彩色

形状,这表明控件的装配已成功

位于,但不可能在客户端CLR中正确执行。

然后,问题可能是由于安全问题(程序集的访问权限

权限)。


你控制的名字是强名吗?如果是这样,您是否已应用

" AllowPartiallyTrustedCallersAttribute"你的

大会?如果没有,你需要使用强大的命名控件:

在AssemblyInfo文件中添加[assembly:AllowPartiallyTrustedCallers()]。

然后重建控件''组装并更换旧的并再次测试

页面。


有关AllowPartiallyTrustedCallers的详细说明属性,

您可以在MSDN中查看以下链接:
http://msdn.microsoft.com/library/en...securityallowp

artiallytrustedcallersattributeclasstopic.asp?fram e = true

此外,有时,某些代码仍然无法在客户机上执行

。然后我们需要手动地调整区域安全。通过.net配置工具在客户端

机器。您可以找到.net配置工具。通过控制

面板---->管理工具---> .net配置工具。启动它并

选择运行时安全策略左侧树视图中的节点。然后在

右侧主视图中,点击调整区域安全性按钮。链接,选择对此计算机进行更改

(默认选项)然后点击下一步,你会在顶部找到一些

大图标选项,选择本地内联网。并移动下面的

滑动条并将其调整为完全信任(给予最大信任)。

因此,我们已经提升了信任度来自本地Intranet区域的程序集。

之后,单击下一步并关闭它。尝试再次访问包含

winform控件的页面以查看问题是否仍然存在。


如果您想了解有关富客户端安全性的更多详细信息

situatoin,您可以访问MSDN中的以下技术文章:

#Code访问.NET中的安全和分发功能增强客户端

应用程序
http:// msdn。 microsoft.com/msdnmag/is...h/default.aspx


请尝试前面的建议,看看它们是否有帮助。如果您对b
有任何疑问,请随时在此发布。

问候,


Steven Cheng
Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Hi John,
Thank you for using MSDN Newsgroup! My name is Steven, and I''ll be
assisting you on this issue.
From your description, you''ve made an Winform control and used it in a web
page displayed in IE. Also, it worked well at the develop machine. However,
when you access the page from other machine, you found the control didn''t
work.
If there is anything I misunderstood, please feel free to let me know.

Since you''ve provided the code period :
<OBJECT id="oFile1"
classid="http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>
</OBJECT>

that specify the assembly''s path as the same place with the page, and the
control can be displayed well from local machine. So I don''t think the
problem is caused by the path of the assembly. Also, I''d like to confirm
something on this issue:
1. All the test machines are intranet based enviroment, yes? All have the
same version of dotnet framework installed?
(At least, have the same highest version?)

2. The FileUpload.dll is put in the same directoy with the page which
contains it? If so, there won''t have problem with the assembly''s location.

3. When request the certain page from other client machine, what does the
page display for the control since it can work. If it is a large rectangle
with a small rectangle(on the left top corner) and also a "X" in the small
rectangle, that indicates the control''s assembly can''t be correctly
located. Else, if in the small rectangle, there are some mini colorful
shapes , that indicates the control''s assembly has been successfully
located, but can''t be executed correctly in client CLR.
Then, the problem is likely due to a security issue(assembly''s access
permission).

Is the control you made strong-named? If so, Have you applied the
"AllowPartiallyTrustedCallersAttribute" to your
assembly? If not, you need to do it with your strong named control:
add [assembly:AllowPartiallyTrustedCallers()] in the AssemblyInfo file.
Then rebuild the control''s assembly and replace the old one and test the
page again.

For detailed description on the "AllowPartiallyTrustedCallers" attribute,
you can view the following link in MSDN:
http://msdn.microsoft.com/library/en...securityallowp
artiallytrustedcallersattributeclasstopic.asp?fram e=true
Also, sometimes, there will be some certain code still unable to execute
well on client machine. Then we need to manully
adjust the "Zone Security" via the ".net Configuration tool" on the client
machine. You can find the ".net Configuration tool" through the Control
Panel---->Administrative Tools--->.net Configuration tool. Start it and
select the "Runtime security policy" node in the left treeview. Then in the
right main view, click the "Adjust Zone Security" link, choose "make change
to this computer" ( default option) and then click next, you''ll found some
big icons options on the top , select the "Local Intranet" and move the
slide bar below and adjust it to "Full Trust"(give the maximum trust).
Thus,we''ve up the trust leve of the assemblies from local intranet area.
After that, click next and close it. Try visiting the page which contains
the winform control again to see whether the problem remains.

If you want more detailed information on the security for rich client
situatoin, you may visit the following tech article in MSDN:
#Code Access Security and Distribution Features in .NET Enhance Client-Side
Apps
http://msdn.microsoft.com/msdnmag/is...h/default.aspx

Please try out the preceding suggestions to see whether they help. If you
have any questions on them, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


嗨John,

感谢您使用MSDN新闻组!我的名字是Steven,我会在这个问题上帮助你。

根据你的描述,你已经制作了一个Winform控件并在一个web

页面显示在IE中。此外,它在开发机器上运行良好。但是,当你从其他机器访问页面时,你发现控件没有工作。

如果有什么我的话误解,请随时告诉我。


因为您提供了代码期限:

< OBJECT id =" oFile1"

classid =" http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>

< / OBJECT>


指定程序集的路径与页面的位置相同,并且

控制可以从本地机器很好地显示。所以我不认为

问题是由程序集的路径引起的。另外,我想在这个问题上确认



1.所有测试机都是基于内联网的环境,是吗?所有人都安装了相同版本的dotnet框架吗?

(至少有相同的最高版本?)


2 .FileUpload.dll与

包含它的页面放在同一个directoy中?如果是这样,组件的位置就不会有问题。


3.当从其他客户端机器请求某个页面时,
$是什么b $ b页面显示控件,因为它可以工作。如果它是一个大矩形

,带有一个小矩形(在左上角),还有一个X。在小的

矩形中,表示控件的装配不能正确地位于
。另外,如果在小矩形中,有一些迷你彩色

形状,这表明控件的装配已成功

位于,但不可能在客户端CLR中正确执行。

然后,问题可能是由于安全问题(程序集的访问权限

权限)。


你控制的名字是强名吗?如果是这样,您是否已应用

" AllowPartiallyTrustedCallersAttribute"你的

大会?如果没有,你需要使用强大的命名控件:

在AssemblyInfo文件中添加[assembly:AllowPartiallyTrustedCallers()]。

然后重建控件''组装并更换旧的并再次测试

页面。


有关AllowPartiallyTrustedCallers的详细说明属性,

您可以在MSDN中查看以下链接:
http://msdn.microsoft.com/library/en...securityallowp

artiallytrustedcallersattributeclasstopic.asp?fram e = true

此外,有时,某些代码仍然无法在客户机上执行

。然后我们需要手动地调整区域安全。通过.net配置工具在客户端

机器。您可以找到.net配置工具。通过控制

面板---->管理工具---> .net配置工具。启动它并

选择运行时安全策略左侧树视图中的节点。然后在

右侧主视图中,点击调整区域安全性按钮。链接,选择对此计算机进行更改

(默认选项)然后点击下一步,你会在顶部找到一些

大图标选项,选择本地内联网。并移动下面的

滑动条并将其调整为完全信任(给予最大信任)。

因此,我们已经提升了信任度来自本地Intranet区域的程序集。

之后,单击下一步并关闭它。尝试再次访问包含

winform控件的页面以查看问题是否仍然存在。


如果您想了解有关富客户端安全性的更多详细信息

situatoin,您可以访问MSDN中的以下技术文章:

#Code访问.NET中的安全和分发功能增强客户端

应用程序
http:// msdn。 microsoft.com/msdnmag/is...h/default.aspx


请尝试前面的建议,看看它们是否有帮助。如果您对b
有任何疑问,请随时在此发布。

问候,


Steven Cheng
Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Hi John,
Thank you for using MSDN Newsgroup! My name is Steven, and I''ll be
assisting you on this issue.
From your description, you''ve made an Winform control and used it in a web
page displayed in IE. Also, it worked well at the develop machine. However,
when you access the page from other machine, you found the control didn''t
work.
If there is anything I misunderstood, please feel free to let me know.

Since you''ve provided the code period :
<OBJECT id="oFile1"
classid="http:FileUpload.dll#FileUpload.FileUpload Control" VIEWASTEXT>
</OBJECT>

that specify the assembly''s path as the same place with the page, and the
control can be displayed well from local machine. So I don''t think the
problem is caused by the path of the assembly. Also, I''d like to confirm
something on this issue:
1. All the test machines are intranet based enviroment, yes? All have the
same version of dotnet framework installed?
(At least, have the same highest version?)

2. The FileUpload.dll is put in the same directoy with the page which
contains it? If so, there won''t have problem with the assembly''s location.

3. When request the certain page from other client machine, what does the
page display for the control since it can work. If it is a large rectangle
with a small rectangle(on the left top corner) and also a "X" in the small
rectangle, that indicates the control''s assembly can''t be correctly
located. Else, if in the small rectangle, there are some mini colorful
shapes , that indicates the control''s assembly has been successfully
located, but can''t be executed correctly in client CLR.
Then, the problem is likely due to a security issue(assembly''s access
permission).

Is the control you made strong-named? If so, Have you applied the
"AllowPartiallyTrustedCallersAttribute" to your
assembly? If not, you need to do it with your strong named control:
add [assembly:AllowPartiallyTrustedCallers()] in the AssemblyInfo file.
Then rebuild the control''s assembly and replace the old one and test the
page again.

For detailed description on the "AllowPartiallyTrustedCallers" attribute,
you can view the following link in MSDN:
http://msdn.microsoft.com/library/en...securityallowp
artiallytrustedcallersattributeclasstopic.asp?fram e=true
Also, sometimes, there will be some certain code still unable to execute
well on client machine. Then we need to manully
adjust the "Zone Security" via the ".net Configuration tool" on the client
machine. You can find the ".net Configuration tool" through the Control
Panel---->Administrative Tools--->.net Configuration tool. Start it and
select the "Runtime security policy" node in the left treeview. Then in the
right main view, click the "Adjust Zone Security" link, choose "make change
to this computer" ( default option) and then click next, you''ll found some
big icons options on the top , select the "Local Intranet" and move the
slide bar below and adjust it to "Full Trust"(give the maximum trust).
Thus,we''ve up the trust leve of the assemblies from local intranet area.
After that, click next and close it. Try visiting the page which contains
the winform control again to see whether the problem remains.

If you want more detailed information on the security for rich client
situatoin, you may visit the following tech article in MSDN:
#Code Access Security and Distribution Features in .NET Enhance Client-Side
Apps
http://msdn.microsoft.com/msdnmag/is...h/default.aspx

Please try out the preceding suggestions to see whether they help. If you
have any questions on them, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


这篇关于使用winforms控件作为Internet Explorer中的对象的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆