Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
877 views
in Technique[技术] by (71.8m points)

.net - Adding System.windows.Forms reference into asp.net website

I have a asp.net application where i use System.Windows.Forms namespace reference to use web browser control.the application runs fine on local system but after hosting it shows error. How do i embed the dll for to use in the web application.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Answering a 3 1/2 year old question is pretty weird...

I. In your web.config, add a reference to Windows.Forms

<system.web>
  <compilation>
    <assemblies>
      <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    </assemblies>
  </compilation>
<system.web>

This only works if the referenced DLL is in the GAC. If it is not:

  1. Create a /Bin folder in your website root.
  2. Copy your DLL there.
  3. Do not add a reference in web.config.

II. In your module/class, import Windows.Forms (VB: Imports / C#: using)

Imports System.Windows.Forms

You can now use the web browser control. It's a bit tricky, though.

Possible uses include: generating screenshots, AJAX crawling (#! >> _escaped_fragment_) etc


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...