The specified network name is no longer available? - c#

I want to play a local video file from nancy embedded http server. It is OK to read a txt file but once it tries to open a video file it gives error :
"The specified network name is no longer available"
on the line
return Response.AsStream(() => File.OpenRead(#"E:\test_videos\test.mp4"), "video/mp4");
I can play the video from my browser, so what is wrong then?
Update: I could play video on FireFox and IE, the error only occurs in chrome.

You probably need to set a static convention, and serve the files directly without passing them trough nancy.

I have implemented mp4handler for nancyfx and it worked.

Your backslashes are probably getting filtered out of existence, try replacing '\' with '\ \', (no space in there) otherwise looks ok to me

Related

Display image with " " character in url

I have a problem in my MVC 3 Application
i can't access to my image with url like that:
http://virtualDirectoryImage.fr/ImageNameContains+.jpg
or
http://virtualDirectoryImage.fr/ImageNameContains%2b.jpg
I got Error 404 file not found (the file exist, i can access to others images witch dont contains plus (+) symbol).
How can i do plz?
IIS7 issue? Application issue?
PS: the images are not hosted in my application. (Virtual Directory, on the same Server)
thx for your help
Can you follow the steps given in the following url
http://helpx.adobe.com/cq/kb/CannotOpenAFileHavingSpecialCharactersInTheFilenameOnIIS.html
basically IIS will block the file names if it contains any special characters.Esspecially if it contains & in the file name for security reasons.It's a good practice to replace the special characters with "_" while uploading the file to the server

The parameter is incorrect. Server or code issue?

Can anybody tell me why I'm getting the error message, "the parameter is incorrect" on one of the pages in my project. Basically, this is happening only in IE, and only one 1 server. I have a dev, a test and a live server. The link has a querystring value "city=Québec". I'm not sure if it has anything to do with the special french e character, but this code works in all browsers on the dev and test sites, and in chrome and firefox on the live server, but if I use IE on the live server, the link sends me to a completely white page that says "the parameter is incorrect". I have absolutely no idea why. Anyone have any idea?
My guess is that Firefox is performing UTF-8 encoding on the URL automatically and IE is not. Just change the link to a UTF-8 encoded version and you should be fine. Example: city=Qu%C3%A9bec
It wouldn't hurt to double-check the HTTP headers your server is sending ....
... but clearly the main problem is in the browser and/or client PC.
Look at these links:
Browser language settings (old version of IE):
http://support.microsoft.com/kb/185035
Unable to create temp files:
http://www.ehow.com/info_12218814_temporary-internet-files-parameter-incorrect.html
Q: What version of IE is experiencing the problem?

TransmitFile security issue in IE and word

I'm trying to transfer a file (word document) from my server to the client
I'm using this :
Response.TransmitFile(path);
Response.End();
In IE when I click open of the download popup, everything is ok and word open with my document.
The problem is when I click the save button in word, it pop me a security/connection popup. I have to give a username/password for mysite.com
That is normal behaviour since Word handles files opened via browser differently - it tries to verify whether they are "WebDAV-accessible" and uses some MS-specific extensions in doing so... that in turn doesn't use your current browser session but tries/needs to establish a new which in turn leads to Word askting you for credentials.
IF you want to just download it locally you could by using a content-disposition header - this way Word sees it as a local file and tries to save it locally upon "Word save button press".
IF you really want it to be saved back to your site it gets a bit tricky... although as you are running on IIS you might be able to implement something in combination with the IIS-built-in WebDAV functionality...
EDIT - as per comments:
For how to use content-disposition http header see for example http://www.jtricks.com/bits/content_disposition.html

Uploading Files with hash(#) in filename to WebDAV Server

I have files with filename containing # in it (eg: #qwerty.txt, file#1.exe).
I want to upload these files to WebDAV Server, running on Linux.
In ASP.Net, I use HttpUtility.UrlEncode() Method for encoding URL.
But, this removes # from the file-names, to be uploaded and thus uploading fails.
Please reply.
Thanks.
UrlEncode does not remove pound/hash characters but replaces them by %23.
Thus #qwerty.txt becomes %23qwerty.txt. If you use that resulting filename to reference the local file for uploading it will fail to find it.
If you want a more definitive answer you might want to update your question with the code you are using to upload the file.

Push notification c# google code showing error "File not found" every time.?

I need to use asp.net c# code for Server of Push notification Service. i have also downloaded Source code from google Source code. there are 3 zip files available . I am using latest Apns-Sharp-1.0.3.0.
but when I am testing it, it gives a "File not found" error every time for the p12 certificate.
The certificate is available at specified path also. I have also tried to read a simple text file and also try other paths also but ever time it gives same error of "File not found at xxxx path."
please help and thanks in advance.
You should denote the base directory for the program to spot the specific file.
string p12File = "yourp12filename.p12";
string p12FilePassword = "yourpassword";
string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File);
This would solve your "File not found" problem.

Categories