Solved

Server.HTMLEncode in a business object

Posted on 2007-04-06
4
373 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
  • 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now