Solved

Server.HTMLEncode in a business object

Posted on 2007-04-06
4
409 Views
Last Modified: 2008-02-01
Is it possible to use Server.HTMLEncode in a business object, or does it always have to be called from a page?  If possible, what's the syntax?
0
Comment
Question by:codequest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:asp_lha
ID: 18869284
yes, you just need to add  referees to System.Web assembly

than you can use it as usual
0
 
LVL 2

Author Comment

by:codequest
ID: 18873029
Thanks for input.  I'm not exactly sure what you meant.

I'm parsing your comment as
"add  reference to System.Web"

I'm using VB, and   "Imports System.Web" doesn't seem to do it.   Any further suggestions?
0
 
LVL 5

Accepted Solution

by:
asp_lha earned 500 total points
ID: 18874037
sorry for my poor English

"Imports System.Web"  is not enough,
first ,right click the ‘Reference’ option under the project inside the solution explorer and select the ‘Add Reference…’ option.
It will show you a user interface screen where you browse for the target assembly.
Now you can select the System.Web assembly,  and then press OK.
0
 
LVL 2

Author Comment

by:codequest
ID: 18878145
Thanks for the input.   I found the "add reference" menu, and did that, and then, experimenting, I got it to work without adding the reference or even an "imports" like this.....

Imports Microsoft.VisualBasic

Public Class ServerHTMLEncodeTest
      Public Function MyHTMLEncode(ByVal varStr As String) As String
            Return System.Web.HttpUtility.HtmlEncode(varStr)
      End Function
End Class

Anyway, we got there.

Thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question