About Me

My photo
Northglenn, Colorado, United States
I'm primarily a BI Developer on the Microsoft stack. I do sometimes touch upon other Microsoft stacks ( web development, application development, and sql server development).
Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Monday, October 24, 2011

Dictionary Not Found

Kept getting the error: "Dictionary Not Found..." once I uploaded new changes to the web server to allow spell checking. So, my first step was to open the developer tools in IE (F12) and do a quick capture of the network traffic.

Which gave:



URL: /fieldperformance/C1Spell_en-US.dct
Method: GET
Result: 404
Type: text/html
Received: 1.37 KB
Taken: 265 ms 
Initiator:
Wait‎‎: 1482
Start: 62
Request: 203
Response‎: 0
Cache: 0
read‎‎ Gap‎‎: 5067

So, it's looking in the fieldperformance folder for the dictionary file. Doing a quick check, yes the file is located there. The problem then ends up being the MIME type is missing.

Going to the IIS Manager, I added the Extension dct with a MIME type of application/octet-stream.



Friday, August 24, 2007

File Download in ASP.Net

Ok, so I'm making my own site and what I am doing is allowing users on my website to upload and download files. These files are placed into my sql-server database. I was having trouble getting the Response.Write to work, so I went to Response.OutputStream.Write instead.

So on my download page I have:

protected void Page_Load(object sender, EventArgs e)
{
String filepath =
Request.Params.Get("Author") + "-" + Request.Params.Get("Title") + ".mp3";
if
(filepath.Length != 0)
{
Stream readStream =
MusicManager.GetSong(Int32.Parse(Request.Params.Get("file")));
int Length =
256;
Response.Clear();
Response.ContentType =
"application/octet-stream";
Response.AddHeader("Content-Disposition",
"attachment; filename=\"" + filepath + "\"");
Response.Flush();
Byte[]
buffer = new Byte[Length];
int bytesRead = readStream.Read(buffer, 0,
Length);
while (bytesRead > 0)
{
Response.OutputStream.Write(buffer,
0, bytesRead);
bytesRead = readStream.Read(buffer, 0,
Length);
}
Response.End();
readStream.Close();
}
}



Of course I have a page that sends in the query string with the necessary info

This seems all simple when it starts working, but it took me 2 hours to get the file to download correctly.