Solved

Can I call Server.UrlEncode from an executable?

Posted on 2007-12-04
2
673 Views
Last Modified: 2012-06-27
I am writing an executable in C# that will send emails with links to my website.  In this executable I want to format the URLs and part of that is to encode the URL parameters.  However, I find that the Server.UrlEncode method is part of System.Web.HttpServerUtility and thus cannot be called from my executable.  It seems like there is no reason that UrlEncode is part of this library... is there a way I can call this method or an equivalent one in my executable?  Or will I have to disassemble the C# and copy out the implementation to my own methods?

Thanks for your help!
0
Comment
Question by:maltomeal8
2 Comments
 
LVL 17

Accepted Solution

by:
Daniel Reynolds earned 125 total points
ID: 20406254
You can reference System.Web assembly in your Windows Forms project and call
the static method HttpUtility.UrlEncode() .
Calling this method doesn't require being run as a web page, you can call it
from a windows forms, console or service application.

see this link:
http://www.thescripts.com/forum/thread233425.html
0
 

Author Closing Comment

by:maltomeal8
ID: 31412673
That's exactly what I was looking for!  Thanks for your speedy reply!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

832 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