Navigation Menu

Skip to content

Commit

Permalink
various encode/decode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mausch committed Sep 29, 2011
1 parent ccf04b4 commit 2202c57
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Figment/Helpers.fs
Expand Up @@ -4,6 +4,8 @@
module Helpers =

open System
open System.Collections.Specialized
open System.Text
open System.Reflection
open System.Web
open System.Web.Routing
Expand Down Expand Up @@ -110,7 +112,17 @@ module Helpers =
genericMethod.Invoke(null, null)

let inline htmlencode x = HttpUtility.HtmlEncode x
let inline htmldecode x = HttpUtility.HtmlDecode x
let inline urlencode (x: string) = HttpUtility.UrlEncode x
let inline urldecode (x: string) = HttpUtility.UrlDecode x
let inline base64encode (x: string) =
if x = null
then null
else Convert.ToBase64String(Encoding.UTF8.GetBytes(x))
let inline base64decode (x: string) =
if x = null
then null
else Encoding.UTF8.GetString(Convert.FromBase64String(x))

type DelegatingHttpRequestBase(request: HttpRequestBase) =
inherit HttpRequestBase()
Expand Down Expand Up @@ -206,4 +218,5 @@ module Helpers =

let withRequest (req: HttpRequestBase) (ctx: HttpContextBase) =
{ new DelegatingHttpContextBase(ctx) with
override x.Request = req }
override x.Request = req }

0 comments on commit 2202c57

Please sign in to comment.