0

What I'm trying to

I'm trying to let a user enter the name of a website in a textbox and click on a button. When the button has been clicked the website URL should be sent to a method which will use a WebBrowser to navigate to the website and take a screenshot of it. Further it should afterwards grab this screenshot and generate a thumbnail of it.

... And the tricky part

The tricky thing is that according to MSDN the System.Drawing should not be used in neither Windows or ASP.NET services, which leaves me with 2 approaches:

  • Ignore the suggestion from MSDN and implement the class which contains the necessary methods.
  • Create a WCF Service with the necessary methods.

The second approach sounds to me that it almost violates the suggestion on MSDN anyway since I implement it in a ASP.NET MVC (connecting to the WCF Host)

Any suggestions?

rsenna
  • 10,960
  • 1
  • 50
  • 60
ebb
  • 8,919
  • 15
  • 62
  • 119

1 Answers1

1

The documentation indeed has this warning, however, thousands of developers on thousands of sites have used the classes in the System.Drawing namespace without much issue.

See this other SO question exactly about this issue, and this one.

Community
  • 1
  • 1
Oded
  • 463,167
  • 92
  • 837
  • 979
  • So you think it would be "fine" to implement the class in my ASP.NET solution, and the WCF service would be redundant? - Friends of mine told me to use a WCF service to also avoid trust problems since some of the classes that I use requires Full Trust... – ebb Feb 22 '11 at 21:21
  • @ebb - The only issues that crop up seem to be under load (and normally to do with resources that are not cleaned up) - you are a better judge of those conditions for your app than I am. – Oded Feb 22 '11 at 21:23
  • Wrap every (seriously) System.Drawing class instance in a using(){} clause, and you're good to go. – Lilith River Oct 24 '11 at 12:41