calvin Posted March 27, 2006 Posted March 27, 2006 I get this error after upgrading from asp.net 1.1 to 2.0 in our web hosting. "Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." The page have add reference to System.Windows.Forms.dll. Below is part of my code: Dim x As Windows.Forms.Form = New Windows.Forms.Form Dim grp As Graphics = x.CreateGraphics() Dim stringFont As New Font("Arial", intFontSize) Dim stringSize As SizeF 'Measure String width stringSize = grp.MeasureString(strStudentName, stringFont) . . . The page have totally no bugs and running well. But get error when upgrading asp.net 1.1 to asp.net2.0 Anyone know the solution? Thanks for all help. Calvin Quote
Administrators PlausiblyDamp Posted March 27, 2006 Administrators Posted March 27, 2006 What are you then doing with the string in question? Are you drawing the string onto an image or something else? If you are using an image then you can use the Graphics.FromImage method to return a valid graphics object and avoid using System.Windows.Forms.dll at all as there isn't any real need to use it within a web application. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
calvin Posted March 28, 2006 Author Posted March 28, 2006 Thanks for your solution, problem solved Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.