Redirect to Word document???
-
I need to use response.redirect to a Word document that open with Word (Not IE prowser). When I type the "\\sitename\wwwroot\appfolder\file.doc" in IE address box, the document will be opened with Word. But when I use Response.Redirect("\\sitename\wwwroot\appfolder\file.doc") in my code the address in IE browser becomes to "href="http://siteurl/sitename/wwwroot/appfolder/file.doc" and get "the page can not be fount" error. How can fix the problem?
-
I need to use response.redirect to a Word document that open with Word (Not IE prowser). When I type the "\\sitename\wwwroot\appfolder\file.doc" in IE address box, the document will be opened with Word. But when I use Response.Redirect("\\sitename\wwwroot\appfolder\file.doc") in my code the address in IE browser becomes to "href="http://siteurl/sitename/wwwroot/appfolder/file.doc" and get "the page can not be fount" error. How can fix the problem?
If the
file.doc
is in the same folder as your .aspx page, would it work to simply use the relative pathResponse.Redirect("file.doc")
? -
If the
file.doc
is in the same folder as your .aspx page, would it work to simply use the relative pathResponse.Redirect("file.doc")
? -
Response.Redirect("file.doc") will open the document in IE browser. I need to open the document in Word.
How it opens on the client is a choice the client gets to make (through their browser settings) - I'm not sure you can limit the client the way you're suggesting (I'd be happy to be proven wrong though)
-
How it opens on the client is a choice the client gets to make (through their browser settings) - I'm not sure you can limit the client the way you're suggesting (I'd be happy to be proven wrong though)
-
Just like I said above, when I type the "\\sitename\wwwroot\appfolder\file.doc" in IE address box, the document will be opened with Word. Is there any way in a asp.net application that can do the same way?
if( File.Exists(Server.MapPath("...")) )
{
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream(Server.MapPath("..."), FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.ContentType = "application/msword";
Response.BinaryWrite(Buffer);
}
else
MessageBox.Show("File not found!");This code fragment will ask user download this file. However user can open this file by press open button. Therefore, MSWord will be open. Is there any suggestion?