|
You shouldn't need any of that code. The SmtpClient will initialize itself based on the settings in the web.config file automatically.
The SmtpClient constructor[^] calls the Initialize method[^], which reads the settings from the config file.
If it's not working, then you need to debug your code to see what settings are actually being read from your config file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Store Dataset into session variable
|
|
|
|
|
Is that an instruction or a proud boast?
|
|
|
|
|
I look at it as a project manager trying to give direction to a team member however inadvertently instead of typing in Microsoft Teams ended up submitting a new post in CodeProject.
|
|
|
|
|
Is this some kind of spam? If not, I'm sorry, but it definitely looks like it LOL.
|
|
|
|
|
Any one please explain the REDUX.
|
|
|
|
|
|
I try to remove Server header IIS8.0 . I use below code in Global.Asax.
protected void Application_PreSendRequestHeaders() {
this.Response.Headers.Remove("Server");
Response.AddHeader("Server", "My httpd server");
}
and i use below code in web.config
[httpRuntime maxRequestLength="50000" requestValidationMode="2.0" enableVersionHeader="false"]
when I run the project I see below issue
"This operation requires IIS integrated pipeline mode"
Although Manage Pipeline mode is integrated mode.
|
|
|
|
|
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
|
|
|
|