Solved

Server.HTMLEncode in a business object

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

19 Experts available now in Live!

Get 1:1 Help Now