|
Why are you trying to do this?
|
|
|
|
|
I try to remover server header IIS8.0
|
|
|
|
|
|
Good Day Everyone
I have a response which i convert to byte array and download the pdf at the end. This code does download a PDF in localhost but gives an error
{"Thread was being aborted."}
and the file still get downloaded correctly. The code is defined as below
<pre>string URL = "http://myserver/ReportServer/Pages/ReportViewer.aspx?%2fbills%2fISU_PDF_GEN_APT&rs:Command=Render";
string Command = "Render";
string Format = "PDF";
string Contract_account_number = AccountNumber;
URL = URL + "&rs:Command=" + Command + "&rs:Format=" + Format + "&Contract_Account_Number=" + Contract_account_number;
System.Net.HttpWebRequest Req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL);
Req.Credentials = System.Net.CredentialCache.DefaultCredentials;
Req.UseDefaultCredentials = true;
Req.Method = "GET";
System.Net.WebResponse objResponse = Req.GetResponse();
System.IO.Stream stream = objResponse.GetResponseStream();
var document = GenericMethods.StreamToByteArray(stream);
Response.AddHeader("Content-type", "application/octet-stream");
Response.AddHeader("Content-Disposition", "attachment; filename=" + AccountNumber + ".pdf");
Response.BinaryWrite(document);
Response.Flush();
Response.End();</pre>
when i host this in IIS i get an Error
The remote server returned an error: (403) Forbidden.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
The ThreadAbortException is expected when you call Response.End :
ThreadAbortException occurs if you use Response.End - ASP.NET | Microsoft Docs[^]
The error in IIS simply means that the user your application pool is running as doesn't have access to the resource you're trying to load. It works when you debug the code in Visual Studio because it's running under your user account at that point.
Change the SSRS permissions to give your App Pool user access to run the reports; change your App Pool to run as a user with the relevant permissions; or change your code to pass the credentials of a user with the relevant permissions instead of relying on the default credentials.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hello sir i have try alot but not found any library that is free and convert odf to image in asp .net core mvc. if you have then kindly suggest me
|
|
|
|
|
Did you try Ghostscript (and its .NET wrapper Ghostscript.NET). These have been able to generate good quality images out of the pages in the PDF document.
|
|
|
|
|
Here's another options in case Ghostscript is not suitable for you
|
|
|
|
|
Hello
Do you know ready plugins for api blog2.0? e.g. Tumblr, Blogger ipt.
Regards
|
|
|
|
|
|
Hi,
I am trying to install Winform Net5 feature on Mac and my desktop.
On Mac, visual studio dees not seems to display this template
|
|
|
|
|
Hi!
Can you recommend the FEED aggregator plugin? Something like CyberSeo for WP?
Regards
|
|
|
|
|
Greetings experts,
I am incredibly frustrated by this task. We have a sorting feature added to our GridView control which works great.
Then we decided to adding sorting up and down arrow and that's when we started having issues.
I have been working on this now for three days and can't seem to get anywhere with it.
I really do need some help.
When we run our code, we get keep getting the following error:
System.ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values.
Parameter name: index'
The error is on this line:
string lbText = ((LinkButton)grvSpeakers.HeaderRow.Cells[i].Controls[0]).Text;
I believe this is the relevant code:
protected void OnSorting(object sender, GridViewSortEventArgs e)
{
string SortDir = string.Empty;
DataTable dt = new DataTable();
dt = ViewState["tables"] as DataTable;
{
if (SortDirection == SortDirection.Ascending)
{
SortDirection = SortDirection.Descending;
SortDir = "Desc";
}
else
{
SortDirection = SortDirection.Ascending;
SortDir = "Asc";
}
DataView sortedView = new DataView(dt);
sortedView.Sort = string.Format("{0} {1}", e.SortExpression, SortDir);
grvSpeakers.DataSource = sortedView;
grvSpeakers.DataBind();
for (int i = 0; i < grvSpeakers.Columns.Count; i++)
{
string lbText = ((LinkButton)grvSpeakers.HeaderRow.Cells[i].Controls[0]).Text;
if (lbText == e.SortExpression)
{
TableCell tableCell = grvSpeakers.HeaderRow.Cells[i];
System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
img.ImageUrl = (SortDir == "Asc") ? "~/Images/down_arrow.png" : "~/Images/up_arrow.png";
tableCell.Controls.Add(new LiteralControl(" "));
tableCell.Controls.Add(img);
}
}
}
}
Please forgive me for the code dump. I am hoping it helps show what I could be doing wrong.
The GridView has 6 header columns with SortExpressions, Speaker Name, Ministry Name, Email, Date Added, Client Name and website URL
Each has a sortExpress like
SortExpression="SpeakerName"
for instance.
Any assistance is greatly appreciated.
Many thanks in advance
|
|
|
|
|
string lbText = ((LinkButton)grvSpeakers.HeaderRow.Cells[i].Controls[0]).Text;
The message suggests that the i index is invalid for the number of cells in the row, or Controls does not contain any items. You need to use the debugger to find out which one is the problem.
|
|
|
|
|
Hi
I have a project developed in ASP.net MVC. Need to print to a receipt printer connected with Network IP. Can you share the code.
Thanks
Jewel
|
|
|
|
|
If the printer is connect to the server, and is available to the user account which your application pool is configured to run as, then you might be able to print to it.
If the printer is connect to the client, then all you can do is issue a window.print(); command in Javascript, and hope that the user picks the correct printer, and that the printed output of the current document matches your requirements.
There is no way to print to a client printer from server-side code, and client-side code deliberately has very little control over printing for security reasons.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Usually you generate a PDF in the correct printer format, present the PDF for download, open the PDF and print.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I had a break in between customer projects and decided to take a stab at upgrading my app from Angular V7 to V10, NetCore V3.1 to V5. Had a hell of a time composing my package.json to not produce any version errors. In my last version of my app I was using ngtools/webpack which seemed to just take care of everything for me. But looking at documentation on the internet, it looks like Webpack is back in style now.
I'm confused on a few things, and thought maybe a passer by may set me straight with some proper info. So I'm suppose put my webpack.config.js file in the root of my .net core project so I can build it using debug. Yet if I want to test my webpack file, it needs to be in the clientapp folder of the root project.
I started writing a new webpack.config.js, and many articles pointed to modifying my angular.json file to run @angular-builders/custom-webpack instead of @angular-devkit/build-angular/@angular-devkit/build-webpack.
Ran into that error on debug and build, "fail, Microsoft.AspNetCore.SpaServices[0], and was wondering if anyone had any insight into this. I do have the modules in node_modules.
fail: Microsoft.AspNetCore.SpaServices[0]
<s> [webpack.Progress] 25% building 32/34 modules 2 active C:\Users\jkirk\source\repos\jkirkerx\jkirkerx\ClientApp\node_modules\babel-loader\lib\index.js??ref--7-0!C:\Users\jkirk\source\repos\jkirkerx\jkirkerx\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\webpack\hot\log.js
I tried a lot of different things, just really need to get straighten out on the base or foundation of webpack, then I can fix one issue at a time.
I upgraded to NetCore 5 and that didn't do anything for the error above. Same thing as NetCore 3.1
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I'm pretty close to solving it now.
Down to 1 error now, Can't find Webpack, and can now clearly see the error in the webpack-dev-server.
I installed done-webpack-plugin to halt on errors and give me a description.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Try from last 1 week not able to refresh Gridview After search function executing please help me any one.
protected void btnSearch_Click(object sender, EventArgs e)
{
if (Txtsearch.Text != "")
{
DataSet ds = new DataSet();
bdm.BiddingID = 0;
bdm.Offset = 1;
bdm.Rows = 10;
bdm.Searchstring = Txtsearch.Text.Trim();
ds = dal.Select_biddingdetails(bdm);
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
////ds.Tables[0].NewRow();
//grdbiddingreport.DataSource = ds.Tables[0];
//grdbiddingreport.DataBind();
//GridView SearchResults = (GridView)grdbiddingreport.FindControl("grdbiddingreport");
//grdbiddingreport.DataSource = ds.Tables[0];
grdbiddingreport.DataSource = ds.Tables[0];
grdbiddingreport.DataBind();
}
else
{
ds.Tables[0].NewRow();
grdbiddingreport.DataSource = ds.Tables[0];
grdbiddingreport.DataBind();
}
}
}
else if (Txtsearch.Text == "")
{
DataSet ds = new DataSet();
bdm.BiddingID = 0;
bdm.Offset = Convert.ToInt32(Session["Offset"]);
bdm.Rows = Convert.ToInt32(Session["Rows"]);
bdm.Searchstring = Txtsearch.Text.Trim();
ds = dal.Select_biddingdetails(bdm);
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
grdbiddingreport.DataSource = ds.Tables[0];
grdbiddingreport.DataBind();
}
else
{
ds.Tables[0].NewRow();
grdbiddingreport.DataSource = ds.Tables[0];
grdbiddingreport.DataBind();
}
}
}
grdbiddingreport.VirtualItemCount = GetTotalCount();
GetPageData(1, 10);
}
-------------------------------------------------------------------------------------------------------View Code
<asp:GridView ID="grdbiddingreport" ShowHeader="true" runat="server" Width="100%" ShowHeaderWhenEmpty="true" class="table table-condensed no-more-tables"
AutoGenerateColumns="false" EmptyDataText="No Data Available..." AllowSorting="true" OnSorting="grdbiddingreport_Sorting" OnRowCreated="grdbiddingreport_RowCreated" AllowPaging="true" AllowCustomPaging="true" OnPageIndexChanging="grddcustomer_PageIndexChanging">
<PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
<PagerStyle HorizontalAlign="Right" CssClass="pagin" />
<Columns>
<asp:TemplateField HeaderStyle-Width="9%" HeaderText="Bidding ID" HeaderStyle-CssClass="gridcolor" HeaderStyle-ForeColor="White" SortExpression="BiddingNo">
<ItemTemplate>
<asp:Label ID="lblBiddingid" runat="server" Text='<%# Eval("BiddingID")%>' Visible="false"></asp:Label>
<asp:Label ID="lblBiddingno" runat="server" Text='<%# Eval("BiddingNo")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Customer Name" HeaderStyle-Width="12%" HeaderStyle-CssClass="gridcolor" HeaderStyle-ForeColor="White" SortExpression="CUstomerName">
<ItemTemplate>
<asp:Label ID="lblcustomername" runat="server" Text='<%# Eval("CUstomerName")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="8%" HeaderText="Date" HeaderStyle-CssClass="gridcolor" HeaderStyle-ForeColor="White" SortExpression="BidDate">
<ItemTemplate>
<asp:Label ID="lbldate" runat="server" Text='<%# Eval("BidDate","{0:MM/dd/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="10%" HeaderText="Total Cost" HeaderStyle-CssClass="gridcolor" HeaderStyle-ForeColor="White" SortExpression="BidPriceAmount">
<ItemTemplate>
<asp:Label ID="lbltotalcost" runat="server" Text='<%# Eval("BidPriceAmount","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Created By" HeaderStyle-Width="12%" HeaderStyle-CssClass="gridcolor" HeaderStyle-ForeColor="White" SortExpression="Createdby">
<ItemTemplate>
<asp:Label ID="lblcreatedby" runat="server"
Text='<%# Eval("Createdby")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="20%" HeaderStyle-CssClass="gridcolor">
<ItemTemplate>
<asp:Button ID="BtnProposal" runat="server" Font-Size="Smaller" ToolTip="Get Proposal" OnClick="BtnProposal_Click" Text="Get Proposal" CssClass="btn" target="_blank" />
<asp:Button ID="Btncontract" runat="server" Font-Size="Smaller" ToolTip="Contract" OnClick="Btncontract_Click" Text="Contract" CssClass="btn" target="_blank" />
<asp:Button ID="Btnspecs" runat="server" Font-Size="Smaller" ToolTip="Specs" OnClick="Btnspecs_Click" Text="Specs" CssClass="btn" target="_blank" />
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField HeaderStyle-Width="10%" HeaderStyle-CssClass="gridcolor">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" OnClick="LinkButton1_Click" runat="server"><span style="font-size:15px;font-weight:bold">FINANCIAL SUMMARY</span></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderStyle-Width="10%" HeaderText="Action" HeaderStyle-CssClass="gridcolor">
<ItemTemplate>
<%--<asp:ImageButton ID="btnview" runat="server" ToolTip="View" ImageUrl="~/images/view.jpg" Width="20px" Height="20px" /> --%>
<asp:ImageButton ID="btnedit" runat="server" ToolTip="Edit" ImageUrl="~/images/Edit.png" Width="20px" Height="20px" />
<asp:ImageButton ID="btndelete" runat="server" CommandArgument='<%# Eval("BiddingID")%>' ToolTip="Delete" OnClientClick="return confirm('Do you want to delete?')" ImageUrl="~/images/delete.png" Width="20px" Height="20px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
|
|
|
|
|
You have code to databind commented out. Debug your code and see what happens.
|
|
|
|
|
Not Getting any changes It's not refreshing or not toughing any error when i comment grdbiddingreport.DataBind()
|
|
|
|
|
I can't run your code. You have to. Debug the code and see what is happening.
|
|
|
|
|
Quote: First for companies like Facebook, YouTube, Instagram and
other companies' database processing to report SQL Server
The communication line is given to our web server
User information is available on this server by
user information to access database data or fetch user-related files.
We get to the point where the user posts the files every day
we store On the database of a computer in the internal network
that has a hard drive with a raid strip.
There is a Windows service on this computer whose job is to
distribute the database table data on computers within the network
up to 100 computers for storage and the computer ip stores the
storage in the table of a computer that is to be extracted.
To identify a suitable computer for distributing the file on it,
it looks at the active IP table and, for example,
if there are 10 active computers,
stores it on one of the ten to be taken And returns the IP
to store the record with the ID on the database of that particular computer.
Now you can use the server link to report or obtain files
The id of the file is stored on a table with ip of computer that stored on back to the server and store
on the on table that inner join with table of users
Now, when the user logs in, his data will be accessible.
Having the IP address of the link server and the ID of
the file storage location, the report can be get with dynamic queries
Microsoft sql server and the speed of getting files depends
on how many of network computers
Windows service must clear the data from its table after saving the data on
the SQL Server database to always serve the file senders with
|
|
|
|
|
You seem to have forgotten to ask a question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|