Solved

Server.HTMLEncode in a business object

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

729 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