Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...