HttpUtility.UrlEncode security workaround

Discussion in 'ASP .Net' started by Marc Cardinal, Oct 4, 2004.

  1. I have a need to encode and decode url content. I'm currently using
    the UrlDecode and UrlEncode methods from the HttpUtility class.

    However the code must be able to run under the .Net Internet
    Permission trust level. Since there is a
    System.Web.AspNetHostingPermission link demand on the HttpUtility
    class, I cannot use the decode and encode methods. Anyone have a
    workaround for this?
     
    Marc Cardinal, Oct 4, 2004
    #1
    1. Advertising

  2. Have you tried to access it through the server object as Server.UrlDecode()
    or HttpContext.Current.Server.UrlDecode()? Sometimes that works better.

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "Marc Cardinal" <> wrote in message
    news:...
    >I have a need to encode and decode url content. I'm currently using
    > the UrlDecode and UrlEncode methods from the HttpUtility class.
    >
    > However the code must be able to run under the .Net Internet
    > Permission trust level. Since there is a
    > System.Web.AspNetHostingPermission link demand on the HttpUtility
    > class, I cannot use the decode and encode methods. Anyone have a
    > workaround for this?
     
    Mark Fitzpatrick, Oct 4, 2004
    #2
    1. Advertising

  3. Hi,

    You could write your own. Here is a link to a page telling you what you
    need to know:

    http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

    If you view source you'll see the javascript to do the conversion. If you
    translate that into VB.Net or C# you'll be all set. Good luck! Ken.

    --
    Ken Dopierala Jr.
    For great ASP.Net web hosting try:
    http://www.webhost4life.com/default.asp?refid=Spinlight
    If you sign up under me and need help, email me.

    "Marc Cardinal" <> wrote in message
    news:...
    > I have a need to encode and decode url content. I'm currently using
    > the UrlDecode and UrlEncode methods from the HttpUtility class.
    >
    > However the code must be able to run under the .Net Internet
    > Permission trust level. Since there is a
    > System.Web.AspNetHostingPermission link demand on the HttpUtility
    > class, I cannot use the decode and encode methods. Anyone have a
    > workaround for this?
     
    Ken Dopierala Jr., Oct 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    4
    Views:
    10,374
    mikeb
    Jan 22, 2004
  2. Dario Sala
    Replies:
    1
    Views:
    3,868
    Karl Seguin
    Nov 15, 2004
  3. Lloyd Sheen

    Problem with Web.HttpUtility.UrlDecode

    Lloyd Sheen, Mar 1, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,827
    Lloyd Sheen
    Mar 2, 2005
  4. CindyH
    Replies:
    1
    Views:
    645
    Alvin Bruney [ASP.NET MVP]
    May 14, 2008
  5. CindyH
    Replies:
    1
    Views:
    925
    Nanda Lella[MSFT]
    Feb 11, 2009
Loading...

Share This Page