Questions tagged [httpserverutility]

11 questions
7
votes
3 answers

Can't find HttpServerUtility class in System.Web in C#

I'm trying to call the HttpServerUtuility.URLDecode function in C# using Visual Studio 2005, but it can't be found. I'm using System.Web properly, but the class doesn't seem to be there. Do I need to add some sort of reference to my project?
Eli Courtwright
  • 186,300
  • 67
  • 213
  • 256
6
votes
1 answer

How can I make HttpContext available to be used by my Unit Tests?

I want to write a unit test which tests the function of a class called UploadedFile. The problem I face is this class' static constructor uses HttpContext.Current property and because I am running my unit test from a class library I do not have an…
pencilCake
  • 51,323
  • 85
  • 226
  • 363
3
votes
1 answer

HttpServerUtility.UrlTokenDecode only seems to return null

I seem to be having an issue with the HttpServerUtility.UrlTokenDecode(string), as it is constantly returning null, causing the program to crash. From what I have gathered, this method will convert a string to it's base64 Byte-Array. Unfortunately,…
3
votes
1 answer

Execute IHttpHandler to MemoryStream

I am wanting to use something like HttpServerUtility.Execute to execute an IHttpHandler and write the handler response to a MemoryStream that can then be parsed into an http response (functionally, I want access to the headers and the content…
Neaox
  • 1,933
  • 3
  • 18
  • 29
2
votes
4 answers

Response.TransmitFile and Server.Transfer

I have a ASP.NET app that at one point generates a PDF file and loads the next page. I can easily do this with two separate buttons but it is made much tougher when I try to do this with one button. When both are fired by the same button the PDF…
Joe Tyman
  • 1,417
  • 5
  • 28
  • 57
1
vote
4 answers

What is the JavaScript equivalent of C#'s HttpServerUtility.UrlTokenDecode?

In JavaScript, how can i decode a string that was encoded in C# using HttpServerUtility.UrlTokenEncode? There are some equivalents in other languages but i couldn't rewrite them in JS. Any help would be appreciated. This is the Java version. This is…
Sobhan
  • 1,051
  • 2
  • 13
  • 29
0
votes
2 answers

Base64 Encoding in Java vs HttpServerUtility.UrlTokenEncode in C#

I'm having a trouble while I tried to encode a String in Java. I have the follwing code in C#, and the string Bpz2Gjg01d7VfGfD8ZP1UA==, when I execute C# code I'm getting: QnB6MkdqZzAxZDdWZkdmRDhaUDFVQT090 public static void Main(string[] args) { …
TimeToCode
  • 901
  • 2
  • 16
  • 34
0
votes
1 answer

Can HttpServerUtility.Execute get binary data?

This is how I normally execute an aspx web form and get a string from the output: public static string GetAspPageOutput(string page) { string html; using (var sw = new StringWriter()) { HttpContext.Current.Server.Execute(page, sw); …
Anders Lindén
  • 6,839
  • 11
  • 56
  • 109
0
votes
1 answer

HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete for Social Providers

As Asked Question1, Question2 from other users but there is no any proper answer got so I asked here. I am using ASP.NET MVC and trying to load social logins providers by partial view. But I can't it gives me an error. This is my code from where I…
0
votes
1 answer

Why doesn't HttpServerUtility.UrlTokenDecode throw an exception when it doesn't find a padding character?

So, let's throw a nonsense string at HttpServerUtility.UrlTokenDecode, and ensure that it ends in the digit 0-9: HttpServerUtility.UrlTokenDecode("fu&+bar0"); and it blows up with a FormatException. Now let's try the same without the number at the…
spender
  • 117,338
  • 33
  • 229
  • 351
0
votes
2 answers

HttpServerUtility.Transfer vs Server.Transfer?

What's the difference between HttpServerUtility.Transfer and Server.Transer?
johntrepreneur
  • 4,514
  • 6
  • 39
  • 52