|
Member 3080470 wrote: Please help me to fix the error That is not possible since no one can guess where it occurs or what your code is doing.
Member 3080470 wrote: If not Is it necessary to reinstall asp.net? Why do you believe that re-installing will fix a (probable) bug in your code.
The only way to resolve issues like this is to do extensive debugging and testing. You first need to identify where the error occurs and try to determine the circumstances that cause it.
|
|
|
|
|
Hello, i am in the process of learning ASP.net and ajax and i stumbled upon a issue. I made a web form application in which i have c# method for image upload and also a ajax function which is giving me issues.
this is my Default.aspx file:
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<a href="#" id="btnImg" onclick="uploadImg()" runat="server">UPLOAD</a>
</div>
</form>
<script>
function uploadImg(){
var formData = new FormData();
formData.append('FileUpload1', $("input[type=file]")[0].files[0]);
$.ajax({
type: "POST",
url: 'Default.aspx/imageUpload',
data: formData,
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert(data);
}
});
}
</script>
and this is my Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
protected void imageUpload(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
Guid _fileNameRandom = Guid.NewGuid();
string _fileNameStr = _fileNameRandom.ToString();
FileUpload1.PostedFile.SaveAs(Server.MapPath("/Images/") + (_fileNameStr + fileName));
Response.Redirect(Request.Url.AbsoluteUri);
}
}
When i run it i get this error in the chrome console:
Quote: Uncaught TypeError: Illegal invocation
at e (jquery.min.js:4)
at xb (jquery.min.js:4)
at Function.r.param (jquery.min.js:4)
at Function.ajax (jquery.min.js:4)
at uploadImg (Default.aspx:33)
at HTMLAnchorElement.onclick (Default.aspx:21)
I assume i didnt do the ajax call correctly, but i cant figure out the problem as im farely new in this field.
|
|
|
|
|
|
Hi,
I am facing too many kill wait alerts issue with my web site.. If we are searching for more results or if response time is late then we are facing kill wait continuously.. Is there any way to avoid or close kill wait popups by using asp.net? If possible please let me know.. It is very helpful to me... Thank you in advance...
|
|
|
|
|
If you're not working over a particularly slow network connection, then you generally shouldn't be getting those. If you're getting that from trivial operations that would be a strong indicator that something is wrong with either the configuration or the code.
If you have business requirements for intensive, long-running operations then you might want to build a model that stores process results and queries those periodically.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Use asynchronous ajax calls when doing your searching etc and they shouldn't trigger the wait dialog.
|
|
|
|
|
Member 10281056 wrote: kill wait alerts issue with my web site. Are you referring to when the browser says something like "The page has become unresponsive?" If so, you need to optimize your code. Implement smaller paging of data or at least figure out what is causing so much slowness and then fix it.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello
I have partly followed this tutorial:
Sending email with an embedded image through ASP.NET[^]
and, though the user receives his email, when I test my SMTP locally, the plain background image (600px x 600px) does not appear. In Visual Studio (2013), I don't get any errors. The image, emailBG.jpg, is in my Images folder in Solution Explorer, and the code I am using to send plain and HTML emails, and for the background image, is as follows:
Dim PlainMessage As AlternateView = AlternateView.CreateAlternateViewFromString("Hello. To reset your password....Nothing, "text/plain")
Dim mimeType As ContentType = New ContentType("text/html")
Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<p style......Nothing, "text/html")
Dim Logo As New LinkedResource(Server.MapPath("~/Images/emailBG.jpg"), "image/jpeg") 'embedded image
Logo.ContentId = "emailBG"
myMessage.AlternateViews.Add(PlainMessage)
myMessage.AlternateViews.Add(HtmlMessage)</<pre lang="HTML"> pre>
Thanks for any advice.
|
|
|
|
|
Please post your question in the forum at the end of the article, so the author sees it.
|
|
|
|
|
Hello Richard
Thanks for your reply.
The article is 10 years old - not sure if the author will even see it.
Thanks again.
|
|
|
|
|
Looks like the HTML version of your message has been truncated, so we can't see what styles you've applied.
And remember, if you're setting a background image for a <p> tag, it will be cropped to the site of that paragraph of text. You probably want to specify the <body> tag, and put the background image there:
Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<body style=""background:url('cid:emailBG') no-repeat;"">...</body>", Nothing, "text/html")
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, you're right. I do have that against 'p' at the moment:
("<p style='font-family, etc.....'>Hello " & strEmailValue & "<br /><br /> To reset your password....etc</p>", Nothing, "text/html")
I will take on board what you suggest about 'body' as opposed to 'p' and use your 'cid:email.BG'.
Would I still need these two lines that follow the above line I have posted above:
Dim Logo As New LinkedResource(Server.MapPath("~/Images/emailBG.jpg"), "image/jpeg")
Logo.ContentId = "emailBG"
Isn't 'Logo.ContentId = "emailBG"' a repetition of your 'cid:emailBG'?
Thanks.
Can you see this message though it is not in 'Preview'?
|
|
|
|
|
Yes, you'd still need the linked resource.
The cid: is the protocol which lets the mail client know that the image should be loaded from the linked resources in the message, rather than trying to load it from a file or a website.
So cid:emailBG in the HTML is a URL that points to the embedded resource with the content ID set to emailBG .
How do I embed images in an email?[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks.
I am familiar with that link - been hours on this!
I will give it all a go and fingers crossed!
Many thanks again for your help.
|
|
|
|
|
Hi,I want to use Skype for develop virtual classroom i.e. Online classroom In The Asp.net web application project with C#.So that when the time comes classes start Skype for all student in this class.
I will be grateful to you if you provide any solution.
Thanks in Advance
modified 25-Feb-17 4:05am.
|
|
|
|
|
|
Hi,
I have developed audio recording facility to my website.. But it is giving wav formatted base64string.. Can we convert wav to mp3 format or if possible can we reduce base64String size? Because internet explorer is supporting only mp3 files to play.. Is there any way to solve my issue?
Any suggestion will be useful for me.. Thanks in advance..
|
|
|
|
|
|
Hi Richard,
Thanks for your valuable reply and solution link.. I will go through on it once..
Is there any way to reduce size of the base64String..I am uploading mp3 file as base64String..It is taking too much time to upload.. I would be very grateful for any feedback you could might be able to give me.
|
|
|
|
|
Not that I've seen.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Respected Sir,
I saw your code regarding "A New Task Scheduler Class Library for .NET"
My question is, I want to create task on XP and later, Server 2000 and later
with BootTrigger,LogonTrigger,DailyTrigger,TimeTrigger triggers.
I am not able to create it on windows 10 using above code.
Will you please suggest me required dll or required changes?
Regards
|
|
|
|
|
Member 10579375 wrote: I saw your code ... Then please post your question in the forum below the code.
|
|
|
|
|
i searched google a lot still got no good explanation with example. mostly all write up is saying put is idempotent and post is not but i need a sample code which discuss or show idempotency of put method. so my request anyone can explain the put idempotency with example code or redirect me to right article link which discuss the same with example code. thanks
tbhattacharjee
|
|
|
|
|
|
I want to redirect to Home.aspx page but I am getting this error message:"System.Web.HttpException: Response is not available in this context" in the line of Response.Redirect("Home.aspx"); Any idea on solving this?
if ((strbuffer[11].ToString() == strCard1[11]))
{
UserID = "0000";
Send_Beep();
System.Diagnostics.Debug.WriteLine(("UserId: " + UserID));
comRFID.Close();
Response.Redirect("Home.aspx");
}
else
{
Response.Write("<script>alert('Card Undefined, Please Register Your Card.');</script>");
}
modified 20-Feb-17 8:58am.
|
|
|
|