homepage Welcome to WebmasterWorld Guest from 54.197.211.197
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Viewing a Word Document
The Word doc is stored in a password-protected folder
rcshield

5+ Year Member



 
Msg#: 4018362 posted 5:57 pm on Nov 3, 2009 (gmt 0)

I have some Word documents that are linked to a page on a Web site. Both the Web page and the Word documents reside in a password-protected folder on the Web server. I have to login to view the Web page. However, I sometimes have to login once more when I click a link to open one of the Word documents.
Does anyone know why I would be prompted to login a second time even after I logged in to view the password-protected Web page?

 

marcel

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4018362 posted 6:09 pm on Nov 3, 2009 (gmt 0)

Does anyone know why I would be prompted to login a second time even after I logged in to view the password-protected Web page?

Are you using IE? or some other browser?

rcshield

5+ Year Member



 
Msg#: 4018362 posted 7:12 pm on Nov 3, 2009 (gmt 0)

I am using IE. I do not experience the issue with Firefox because firefox automaticcly prompts me to save the document to my workstation.

marcel

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4018362 posted 7:26 pm on Nov 3, 2009 (gmt 0)

Oh, I thought it would be the other way around... that Firefox would force you to login twice.

One option is to always force a download, you can do that with the following code (C#)

string filepath = Request.QueryString.Get("/Docs/WordDoc.doc");
string filename = System.IO.Path.GetFileName(Server.MapPath(filepath));
FileInfo fi = new FileInfo(Server.MapPath(filepath));
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + filename);
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "application/msword";
Response.WriteFile(Server.MapPath(filepath));
Response.End();

If that is not an option, how are you protecting the folder? Through IIS, or in the folder properties itself?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved