Jul 15, 2014, 1:47 AM
No response with status code 200
Hi all,
I would like to click a link in grid panel and then pop up a new window to review the pdf file. But, the program return the No response error. I have checked the status code for the server side method and it seems ok as return 200. I have no idea why the result like this. Please help me to solve it.
In my page.aspx, the code is shown as following:
I would like to click a link in grid panel and then pop up a new window to review the pdf file. But, the program return the No response error. I have checked the status code for the server side method and it seems ok as return 200. I have no idea why the result like this. Please help me to solve it.
In my page.aspx, the code is shown as following:
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var myCommand = function (a) {
return App.direct.buttonOnClick(a.id, {
isUpload: true
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server"/>
<ext:GridPanel ID="GridPanel1" runat="server" Width="1199" Height="500" Title="PaySlip">
<Store>
<ext:Store ID="PayslipStore" runat="server" RemoteSort="true" PageSize="5">
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model ID="PayslipModel" runat="server" IDProperty="fileName">
<Fields>
<ext:ModelField Name="fileName" Mapping="fileName"/>
<ext:ModelField Name="filePath" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="filename" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="25" />
<ext:TemplateColumn Text="FileName" DataIndex="fileName" runat="server" Width="350">
<Template runat="server">
<Html>
<a id="{fileName}" onclick="myCommand(this)" href="javascript:void(0);" target="_blank">{fileName}</a>
</Html>
</Template>
</ext:TemplateColumn>>
<ext:Column ID="Column2" runat="server" DataIndex="filePath" Text="Path" Width="824" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" DisplayInfo="true" DisplayMsg="Displaying files {0} - {1} of {2}"
EmptyMsg="No files to display" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
And the below is my aspx.cs:[DirectMethod(Timeout=30000)]
public void buttonOnClick(String name)
{
Response.ContentType = "application/pdf";
Response.AppendHeader("content-disposition", "inline; filename=" + name);
Config.Admin admin = Config.AdminCtrl.GetAdmin();
string userId = admin.UserId;
string newpath = "~/Payslip/";
string fileDest = newpath + userId.Trim().ToLowerInvariant() + "/" + name;
FileInfo fileInfo = new FileInfo(Server.MapPath(fileDest));
Response.AppendHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Cache-control", "no-store");
Response.TransmitFile(Server.MapPath(fileDest));
Response.End();
}
Additional, if i use Response.ContentType = "application/octet-stream"; instead of Response.ContentType = "application/pdf";, i can download the file but i would like to pop up a new window to review it rather than download it. Is it related to the content type?