|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
No open/save promptHi;
I have a HyperLinkField and have set Target="_blank" in the properties. When I click on it it asks me if I want to save or open the file. I sthere a way to have it always just open the file? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm Hi Dave,
This prompt is controlled by user, it's not possible to force open it either in server-side code or javascript code. It's for security reason, you don't want a web site to open arbitrary file automatically. When the user gets the prompt, he/she can uncheck the "Always ask before opening this type of file", -- which saves the setting in registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute. On the other hide, we can do the opposite thing: we can force a file always to be downloaded instead of open directly by setting Content-Type and Content-Disposition headers" #How To Raise a "File Download" Dialog Box for a Known MIME Type http://support.microsoft.com/default.aspx/kb/260519 Sincerely, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. If you are using Outlook Express, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. this is weird because it even does it for html files - yet normally when I
click on a link that launches anohter window - it just does it. -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > Hi Dave, > > This prompt is controlled by user, it's not possible to force open it > either in server-side code or javascript code. It's for security reason, > you don't want a web site to open arbitrary file automatically. When the > user gets the prompt, he/she can uncheck the "Always ask before opening > this type of file", -- which saves the setting in registry: > HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute. > > On the other hide, we can do the opposite thing: we can force a file always > to be downloaded instead of open directly by setting Content-Type and > Content-Disposition headers" > > #How To Raise a "File Download" Dialog Box for a Known MIME Type > http://support.microsoft.com/default.aspx/kb/260519 > > > Sincerely, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. If you are using Outlook Express, please make sure you clear the > check box "Tools/Options/Read: Get 300 headers at a time" to see your reply > promptly. > > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscriptions/support/default.aspx. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > Do you mean that following html tag will prompt the user to open/save the
html file? <a href="test.htm" target="_blank">test.htm</a> and what if you remove the target attribute? Does only one machine has this issue or all have it? Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Not exactly - I have a HyperLinkField with the following:
DataNavigateUrlFields="ID, Ext" DataNavigateUrlFormatString="~/report-view.{1}?ID={0}" Target="_blank" - I'm not sure how this is handled by ASP.NET. -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > Do you mean that following html tag will prompt the user to open/save the > html file? > > <a href="test.htm" target="_blank">test.htm</a> > > > and what if you remove the target attribute? > > > Does only one machine has this issue or all have it? > > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > What's the result html looks like? The HyperLinkField is generating html
content such as: <a href="report-view.htm?ID=15" target="_blank">here</a> If the ID=15 and Ext=htm. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Here is the actual html from "view source" on the generated page:
<a onMouseOver="this.firstChild.src='images/button_over.gif';" onMouseOut="this.firstChild.src='images/button.gif';" onClick="this.firstChild.src='images/button_click.gif';" href="report-view.html?ID=101" target="_blank"><img src="images/button.gif" alt="view the report mondays" style="border-width:0px;" /></a> -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > What's the result html looks like? The HyperLinkField is generating html > content such as: > > <a href="report-view.htm?ID=15" target="_blank">here</a> > > If the ID=15 and Ext=htm. > > > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > I've tested it on my side, it's still working correctly, I don't see the
open/save prompt for a simple .html file. 1) Does it work if you remove the 'target="_blank"' attribute? 2) Does this only reproduce on a specific client system? 3) Does it reproduce using only static html files? 4) Does it reproduce using .htm extension? 5) Would you please try to use Fiddler to see the response's Content-Type header? Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Hi;
I started my ASP.NET app and then created the file below trying both .html and .htm and when I click on the link I get prompted. Here is the file: <html> <body> <a onMouseOver="this.firstChild.src='images/button_over.gif';" onMouseOut="this.firstChild.src='images/button.gif';" onClick="this.firstChild.src='images/button_click.gif';" href="report-view.htm?ID=101" target="_blank"><img src="images/button.gif" alt="view the report mondays" style="border-width:0px;" /></a> </body> </html> One follow-on note. This is not an actual file on my system. This file is
handled by: <httpHandlers> <add verb="*" path="report-view.*" type="ReportView"/> </httpHandlers> -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > I've tested it on my side, it's still working correctly, I don't see the > open/save prompt for a simple .html file. > > 1) Does it work if you remove the 'target="_blank"' attribute? > 2) Does this only reproduce on a specific client system? > 3) Does it reproduce using only static html files? > 4) Does it reproduce using .htm extension? > 5) Would you please try to use Fiddler to see the response's Content-Type > header? > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Would you please show some code of your custom http handler?
Also, what's the output's content-type? Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Here is the entire class. I think it's the bottom 4 or 5 lines that matter.
/* * Copyright (c) 2006 by Windward Studios, Inc. All rights reserved. * * This software is the confidential and proprietary information of Windward Studios ("Confidential Information"). * You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the * license agreement you entered into with Windward Studios, Inc. */ using System.Web; using System; using System.Web.SessionState; using net.windward.portal; using net.windward.api.csharp; using System.IO; using net.windward.portal.net.data; using net.windward.portal.security; using net.windward.portal.audit; /// <summary> /// Displays the report requested by the url. /// </summary> public class ReportCreate : IHttpHandler, IRequiresSessionState { public const string IMAGES_DIR = "temp-images"; #region IHttpHandler Members public bool IsReusable { get { return false; } } /// <summary> /// Create a report and return it as the page. /// </summary> /// <param name="context">The request context.</param> public void ProcessRequest(HttpContext context) { // make sure is a user. Checks access rights to this template below. if (!PortalRole.IsInRole((PortalRole.ROLES.USER))) throw new PortalSecurityException(PortalSecurityException.TYPE.NEED_ROLE, PortalRole.ROLES.USER.ToString()); int id; try { id = Convert.ToInt32(context.Request.QueryString["wr_id"]); } catch (Exception ex) { throw new InvalidParametersException("wr_id", context.Request.QueryString["wr_id"], ex); } ReportItem.FORMAT format; try { format = ExtensionConvert.ToFormat(context.Request.QueryString["wr_format"]); } catch (Exception ex) { throw new InvalidParametersException("wr_format", context.Request.QueryString["wr_format"], ex); } // set up the maps - we use for all datasources KeyPairDictionary vars = new KeyPairDictionary(); for (int ind = 0; ind < context.Request.QueryString.Count; ind++) { string key = HttpUtility.UrlDecode(context.Request.QueryString.GetKey(ind)); if (!key.StartsWith("wr_")) vars.Add(key, HttpUtility.UrlDecode(context.Request.QueryString.Get(ind))); } Report report = GenerateReport.Create(id, format, vars, context.Server.MapPath(IMAGES_DIR), IMAGES_DIR, "wr"); Auditor.Log(Auditor.MODULE.REPORT, Auditor.OPERATION.CREATE, context.Request.RawUrl); // track image files created if (report is ReportHtml) foreach (HtmlBitmap bitmap in ((ReportHtml)report).Bitmaps) Global.AddTempFile(context.Session, bitmap.Filename); context.Response.Clear(); context.Response.ClearHeaders(); context.Response.ClearContent(); context.Response.ContentType = ExtensionConvert.ToContentType(format); // returns MediaTypeNames.Text.Html ((MemoryStream)report.GetReport()).WriteTo(context.Response.OutputStream); context.Response.End(); } #endregion } -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > Would you please show some code of your custom http handler? > > Also, what's the output's content-type? > > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Hi Dave,
I just tried again using a custom http handler and unfortunately I still wasn't able to reproduce the issue. Since I don't have your report code, I'm using following simple http handler: /// <summary> /// Displays the report requested by the url. /// </summary> public class ReportCreate : IHttpHandler, IRequiresSessionState { public const string IMAGES_DIR = "temp-images"; #region IHttpHandler Members public bool IsReusable { get { return false; } } /// <summary> /// Create a report and return it as the page. /// </summary> /// <param name="context">The request context.</param> public void ProcessRequest(HttpContext context) { context.Response.ContentType = MediaTypeNames.Text.Html; string text = "Hello"; MemoryStream ms = new MemoryStream(); byte[] buf = Encoding.ASCII.GetBytes(text); ms.Write(buf, 0, buf.Length); ms.Seek(0, SeekOrigin.Begin); ms.WriteTo(context.Response.OutputStream); context.Response.End(); } #endregion } Here's my web.config: <system.web> <httpHandlers> <add verb="*" path="report-view.*" type="ReportCreate, __code" /> </httpHandlers> ... HomePage.htm: <a href="report-view.htm" target="_blank">Report View</a> report-view.htm doesn't exist. When I view HomePage.htm in browser, it correctly opens a new window and shows "Hello". I noticed you haven't confirmed whether this issue exist on a specific client or not. If it exists on all you system, would you please help me to create a more complete reproducible project? Thanks. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Hi;
Ok, I figured you know this well and your code works. So I took your code, it worked on mine. I then looked for differences and here is the problem I had: context.Response.AddHeader("Content-Disposition", "attachment;filename=" + ri.Title + ext); Got rid of that and now it's fine. -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > Hi Dave, > > I just tried again using a custom http handler and unfortunately I still > wasn't able to reproduce the issue. Since I don't have your report code, > I'm using following simple http handler: > > /// <summary> > /// Displays the report requested by the url. > /// </summary> > public class ReportCreate : IHttpHandler, IRequiresSessionState > { > > public const string IMAGES_DIR = "temp-images"; > > #region IHttpHandler Members > > public bool IsReusable > { > get { return false; } > } > > /// <summary> > /// Create a report and return it as the page. > /// </summary> > /// <param name="context">The request context.</param> > public void ProcessRequest(HttpContext context) > { > context.Response.ContentType = MediaTypeNames.Text.Html; > string text = "Hello"; > MemoryStream ms = new MemoryStream(); > byte[] buf = Encoding.ASCII.GetBytes(text); > ms.Write(buf, 0, buf.Length); > ms.Seek(0, SeekOrigin.Begin); > ms.WriteTo(context.Response.OutputStream); > context.Response.End(); > } > > #endregion > > } > > Here's my web.config: > > <system.web> > <httpHandlers> > <add verb="*" path="report-view.*" type="ReportCreate, __code" /> > </httpHandlers> > ... > > HomePage.htm: > > <a href="report-view.htm" target="_blank">Report View</a> > > > report-view.htm doesn't exist. > > When I view HomePage.htm in browser, it correctly opens a new window and > shows "Hello". > > I noticed you haven't confirmed whether this issue exist on a specific > client or not. > > If it exists on all you system, would you please help me to create a more > complete reproducible project? Thanks. > > > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Dave,
I'm glad that you've found the cause. Yes this header is used to force browser download the file. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. One more follow-on note. That same page has a standard <a href=... to an html
file that exists with target='_blank' - and it pops up with no prompt. So it appears to be something about it being returned by a program and/or the fact that there is javascript involved. -- Show quoteHide quotethanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm "Walter Wang [MSFT]" wrote: > I've tested it on my side, it's still working correctly, I don't see the > open/save prompt for a simple .html file. > > 1) Does it work if you remove the 'target="_blank"' attribute? > 2) Does this only reproduce on a specific client system? > 3) Does it reproduce using only static html files? > 4) Does it reproduce using .htm extension? > 5) Would you please try to use Fiddler to see the response's Content-Type > header? > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > >
ERROR: The state information is invalid for this page and might be corrupted
How to get GridView row from DataKey? Drop Down List issue themes Images Item has already been added. Key in dictionary can't remove listitem from ddl in loop data field - change true/false to Yes/No asp.net 2.0 site menu control (from navigation block) and IE 5 compatibility Parameter as web user control Problem using themes in web user controls |
|||||||||||||||||||||||