Get Error after upgrading from asp.net 1.1 to 2.0

calvin

Regular
Joined
Nov 6, 2003
Messages
71
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
 
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.
 
Back
Top