httpserverutility

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

你离开我真会死。 提交于 2019-12-23 08:05:34
问题 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? 回答1: A few points: You need a reference to the System.Web assembly You need to get the class name right ( HttpServerUtility , not HttpServerUtuility ) You need to get the method name right ( UrlDecode , not URLDecode ) You need an instance of the class,

HttpServerUtility.UrlTokenDecode only seems to return null

谁说胖子不能爱 提交于 2019-12-02 00:57:07
问题 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, the original developer of the code is no longer with us, and it seems not many people in my office are familiar with the code. public string DecodeUrlData(string urlData) { string lsReturnVal = string.Empty; byte[] decodedrtfBytes =

HttpServerUtility.UrlTokenDecode only seems to return null

筅森魡賤 提交于 2019-12-01 21:54:57
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, the original developer of the code is no longer with us, and it seems not many people in my office are familiar with the code. public string DecodeUrlData(string urlData) { string lsReturnVal = string.Empty; byte[] decodedrtfBytes = HttpServerUtility.UrlTokenDecode(urlData); lsReturnVal = System.Text.ASCIIEncoding.ASCII.GetString(decodedrtfBytes);

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

风格不统一 提交于 2019-12-01 04:48:31
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 HttpContext at the testing time. Look at my static constructor: static UploadedFile() { if (HttpContext.Current == null) throw new Exception("web server not available"); HttpServerUtility server = HttpContext.Current.Server; // SET UploadedFileMappingFile Names: _resourceFileNames = new StringDictionary(); _resourceFileNames[_suppoertedFileStructures

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

谁说我不能喝 提交于 2019-12-01 02:33:50
问题 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 HttpContext at the testing time. Look at my static constructor: static UploadedFile() { if (HttpContext.Current == null) throw new Exception("web server not available"); HttpServerUtility server = HttpContext.Current.Server; // SET