Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
880 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...