I have an asp.net panel having various controls including gridview. I have converted this panel into pdf and attached it as an email attachment using memory stream. Everything is working fine. Now I have an File upload control outside panel through which I have to attach a file and send it in mail along with the already attached panel. But I am unable to figure out how to do it.
I have several images saved as binary data in the DB. How would I remove them and attach them to an email? In the table, I have the filename, description, file(binary data), and content type.
I have created a simple email form and when I try to attach file more than 2MB it just crashes with generic error message. I can't find the right keyword to bing (google) it.
I have the following code, everything works if i remove the attachment lines. But when i add them back i get the error below: we manage our files and content thru a content management system, so thats the reason for the links as they are with the "id=" copying the link into a browser works, but i need to attach the physical file to an email to send. If it cant be done then, we will have to just move the files into a folder outside of our management system.
i have a Button on a HTML page . i want to attach file upload control on this button. i mean when a user click this button , file upload control will diaplay, and selected file will be uploaded. tell me how can i do that?
I have no experience on this matter, so I do not expect anyone to explain in details how this is done, just point me in the right direction, maybe tell me what the correct name for this is. I'm sure it is pretty commonly in use.
I think the best way to explain this, is through my exact need. So, I have a button on my website that should cause the user to download an exe file. The exe file pretty much gathers a few informations from the users PC, and post them to my data-base through a web-service. Now my problem is, these informations should be assigned to the user who downloaded the exe file's row in the DataBase.
All this would be solved by assigning a single Integer value(the users ID) to this exe file on the download request, and then a way for the exe file to also get this value assigned to it, but how do I do that?
My language is asp.net for my website, and the exe file is written in vb.net.
I know I could fake this by making the exe file show a login-form and get the user-id this way, but I really like the application run without the user noticing to much.
I have an aspx page (c#) that a user can upload an image file. I'd also like them to be able to attach this image file. Is it possible to attach the image file to the email then send without saving a copy of the attchment to the web server? I don't need a copy of the file, just need to attach it.
My hosting company provider MS SQL Express as part of my hosting package, they have provided me with both the name and IP address of the server running MS SQL Express.
I have created a database on this server via management studio and when I create a connection string like this (connectionString="Data Source=ServerName/IP;Persist Security Info=True;User ID=xxx;Password=xxx") my application works fine.
But if I create a local database file and try to attach this with a connection string like this (connectionString="Data SourceServerName/IP; AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance = True ; Trusted_Connection=Yes) my application doesn't work.
Therefore my questions are:-
Is there something wrong with my connection string? Can you use a local database file within a production environment?
I have a project I am working that requires me to go to an FTP port and copy a file to the local machine... so far so good... the next step is to take the comma delimited file and import the records (rows) into a local Access database...
Should I be looking the Attach method in Access? To attach and dump all the data in one shot?
OR To open the file with StremRead and process each row one at a time?
I am using VS2008, C#, .NET 3.5, Access 2007... once in production there could 20 - 30 thousand records to be appended to the DB then normalised.
I m trying to save files like pdf, word, excel etc... into sql express, but m getting this error in my web page:An attempt to attach an auto-named database for file C:Usersmalek.safaDocuments est vbSavingFileInDBSavingFileInDBApp_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. m not getting errors inside my code, just this one appearing on the web page.
I'm using VS 2010. And in VS 2010 it's even more painful now to attach to the worker process when you want to test your local IIS site via IIS, not the VS built-in web server.It's more painful because now when you select the worker process () via the Debug Menu | Attach to Process | w3wp.exe it brings up an additional prompt asking if you're sure you want to do this.
I have a form on which anyone can send me his/her information. Now i want to add 2 or 3 file upload options so that anyone from the website can send me their files along with the information. For getting information i am using this code (in button click) which works fine for me:
using System; using System.Net.Mail; using System.Text; using System.Web.UI; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; protected void btnMyButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { string enquiry = txtEnquiry.Text.Trim(); if (String.IsNullOrEmpty(enquiry)) return; string emailTitle = GetLocaleResourceString("MyTopic.EmailTitle"); string fullName = txtFullName.Text.Trim(); string email = txtEmail.Text.Trim(); string subject = string.Format("{0}. {1}", SettingManager.StoreName, emailTitle); var body = new StringBuilder(); body.AppendFormat("<hr />{0} ({1})<hr />", emailTitle, DateTime.Now.ToShortDateString()); body.AppendFormat("<b>{0}:</b> {1}<br />", GetLocaleResourceString("MyTopic.FullName"), fullName); body.AppendFormat("<b>{0}:</b> {1}<br />", GetLocaleResourceString("MyTopic.E-MailAddress"), email); body.Append("<br />"); body.AppendFormat("<b>{0}:</b><br /> {1}<br />", GetLocaleResourceString("MyTopic.Enquiry"), MessageManager.FormatContactUsFormText(enquiry)); var from = new MailAddress(email, fullName); var emailAccount = MessageManager.DefaultEmailAccount; string body2 = body.ToString(); //required for some SMTP servers if (SettingManager.GetSettingValueBoolean("Email.UseSystemEmailForContactUsForm")) { from = new MailAddress(emailAccount.Email, emailAccount.DisplayName); body2 = string.Format("<b>From</b>: {0} - {1}<br /><br />{2}", Server.HtmlEncode(fullName), Server.HtmlEncode(email), body2); } var to = new MailAddress(emailAccount.Email, emailAccount.DisplayName); MessageManager.InsertQueuedEmail(5, from, to, string.Empty, string.Empty, subject, body2, DateTime.UtcNow, 0, null, emailAccount.EmailAccountId); pnlResult.Visible = true; pnlRequestQuote.Visible = false; }
Now I added 3 file upload options in the page, now when i try to add code in .cs file i get errors. This is what i am trying to add (in BOLD)
protected void btnMyButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { string enquiry = txtEnquiry.Text.Trim(); if (String.IsNullOrEmpty(enquiry)) return; string emailTitle = GetLocaleResourceString("MyTopic.EmailTitle"); string fullName = txtFullName.Text.Trim(); string email = txtEmail.Text.Trim(); string subject = string.Format("{0}. {1}", SettingManager.StoreName, emailTitle); var body = new StringBuilder(); body.AppendFormat("<hr />{0} ({1})<hr />", emailTitle, DateTime.Now.ToShortDateString()); body.AppendFormat("<b>{0}:</b> {1}<br />", GetLocaleResourceString("MyTopic.FullName"), fullName); body.AppendFormat("<b>{0}:</b> {1}<br />", GetLocaleResourceString("MyTopic.E-MailAddress"), email); body.Append("<br />"); body.AppendFormat("<b>{0}:</b><br /> {1}<br />", GetLocaleResourceString("MyTopic.Enquiry"), MessageManager.FormatContactUsFormText(enquiry)); //'Attach the file if (FileUpload2.HasFile) { body.Attachments.Add(new Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName)); body.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName)); body.Attachments.Add(new Attachment(FileUpload2.PostedFile.InputStream, FileUpload2.FileName)); } else { body.Attachments.Add(new Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName)); body.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName)); } var from = new MailAddress(email, fullName); var emailAccount = MessageManager.DefaultEmailAccount; string body2 = body.ToString(); //required for some SMTP servers if (SettingManager.GetSettingValueBoolean("Email.UseSystemEmailForContactUsForm")) { from = new MailAddress(emailAccount.Email, emailAccount.DisplayName); body2 = string.Format("<b>From</b>: {0} - {1}<br /><br />{2}", Server.HtmlEncode(fullName), Server.HtmlEncode(email), body2); } var to = new MailAddress(emailAccount.Email, emailAccount.DisplayName); MessageManager.InsertQueuedEmail(5, from, to, string.Empty, string.Empty, subject, body2, DateTime.UtcNow, 0, null, emailAccount.EmailAccountId); pnlResult.Visible = true; pnlRequestQuote.Visible = false; }
I get this error message:
System.Text.StringBuilder' does not contain a definition for 'Attachments' and no extension method 'Attachments' accepting a first argument of type 'System.Text.StringBuilder' could be found (are you missing a using directive or an assembly reference?)
Failed to generate sql server user instance of sql server due to failure in starting the process of user instance . The connection will be closed. So that i installed the sql server management studio 2008 , and i created the database , no when am trying to execute the login form , it shows this error
An attempt to attach an auto-named database for file C://Program Files//Microsoft SQL Server//MSSQL.1//MSSQL//Data//classi.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I am working on the Web application, at time of run the my application open login page but browser disconnect from my application. So I am not able to debug the code. how to stop this disconnectivity between browser and my web application.