Showing posts with label library. Show all posts
Showing posts with label library. Show all posts

Monday, March 26, 2012

System.Net.Mail library problems

Hi everyone, I'm newbie on ASP.net and I was trying to to an application to send emails with the following code using System.net.mail namespace:

PrivateSub Envio_Correo(ByVal rutaAsString)'Creando la instancia del mensajeDim correoAsMailMessage = nothing

correo.From =

New MailAddress("b98123839@dotnet.itags.org.usmp.edu.pe")

correo.To.Add(

"amonasiq@dotnet.itags.org.usmp.edu.pe")

correo.Subject =

"Archivo de Confirmación de matricula"

correo.Body =

"Se adjunto archivo de confirmación de matricula de su respectiva facultad"

correo.IsBodyHtml =

False'correo.Attachments.Add(New Attachment(ruta))

correo.Priority = MailPriority.Normal

'Crando la instancia del SMTP clienteDim smtpAsNew SmtpClient

smtp.Host =

"192.168.1.53"Try

smtp.Send(correo)

Catch exAs SmtpException

lMenErr.Text =

"Paso 4: Enviando el correo: " + ex.Message.ToString()

lMenErr.ForeColor = System.Drawing.Color.Red

EndTryEndSub

But always get the same error: Mailbox unavailable. The server response was: Error: Message content rejected

But if i use the namespace system.web.mail with almost the same code:

PrivateSub enviar_correo_antiguo(ByVal rutaAsString,ByVal facuAsString)Dim correoAsNew MailMessageDim adjuntoAsNew MailAttachment(ruta)

correo.From =

"desarrollo@dotnet.itags.org.usmp.edu.pe"

correo.To = Devolver_mail_ora(facu)

correo.Subject =

"Archivo de Confirmación de matricula"

correo.Body =

"Se adjunto archivo de confirmación de matricula de su respectiva facultad"

correo.Attachments.Add(adjunto)

SmtpMail.SmtpServer =

"192.168.1.53"Try

SmtpMail.Send(correo)

Catch exAs Exception

lMenErr.Text =

"Paso 5: Enviando el correo: " + ex.Message.ToString()

lMenErr.ForeColor = System.Drawing.Color.Red

EndTryEndSub

I dont have any problem at all, Could anyone tell me what is wrong in my code?

Sincerly

Kryor

system.web.mail = asp.net version 1.1
system.net.mail= asp.net version 2.0

I know system.web is for framework 1.1 and system.net is for 2.0 but why is working with the old namespace and not with the new one being almost the same code.
each website can only run 1 framework- even if both are installed.
It seems your website is configured to run framework 1.1 ( thats my guess, based on what you posted )
There is a tab in IIS where you set the version for each website.

System.NET is through sockets so you may have to add more code. Try the link below for more about System.NET.Mail. Hope this helps.

http://www.systemnetmail.com/

Tuesday, March 13, 2012

System.Runtime.InteropServices.COMException (0x800A1066)

I m using Office 10.0 Com library for power point and for word application in
my Web application but when i run it through web server of web hosting site
that time it is throwing exception like following

System.Runtime.InteropServices.COMException (0x800A1066)

can any one help me regarding this."akshar108" <u37462@.uwewrote in message news:783f955f1cd23@.uwe...

Quote:

Originally Posted by

>I m using Office 10.0 Com library for power point and for word application
>in
my Web application but when i run it through web server of web hosting
site
that time it is throwing exception like following
>
System.Runtime.InteropServices.COMException (0x800A1066)
>
can any one help me regarding this.


Server-side Office automation isn't supported by Microsoft because, as you
have discovered, it doesn't work:
http://support.microsoft.com/defaul...-US;q257757#kb2
Depending on what your exact requirements are, this will be your only
option:
http://www.aspose.com/Products/Aspo...ds/Default.aspx
http://www.aspose.com/Products/Aspo...es/Default.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
but if i want to use free component then how can i count word of doc, ppt
files and do u know any technique for count word of pdf file in .net then
please say me

Mark Rae [MVP] wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

>>I m using Office 10.0 Com library for power point and for word application
>>in


>[quoted text clipped - 5 lines]

Quote:

Originally Posted by

>>
>can any one help me regarding this.


>
>Server-side Office automation isn't supported by Microsoft because, as you
>have discovered, it doesn't work:
>http://support.microsoft.com/defaul...-US;q257757#kb2
>
>Depending on what your exact requirements are, this will be your only
>option:
>http://www.aspose.com/Products/Aspo...ds/Default.aspx
>http://www.aspose.com/Products/Aspo...es/Default.aspx
>


"akshar108" <u37462@.uwewrote in message news:7840ea68455d9@.uwe...

Quote:

Originally Posted by

Quote:

Originally Posted by

>>Server-side Office automation isn't supported by Microsoft because, as you
>>have discovered, it doesn't work:
>>http://support.microsoft.com/defaul...-US;q257757#kb2
>>
>>Depending on what your exact requirements are, this will be your only
>>option:
>>http://www.aspose.com/Products/Aspo...ds/Default.aspx
>>http://www.aspose.com/Products/Aspo...es/Default.aspx


Quote:

Originally Posted by

but if i want to use free component then how can i count word of doc, ppt
files and do u know any technique for count word of pdf file in .net then


You'll have to look for a free component to do this - I don't know of one...

However, Aspose will do everything you require...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net

System.Security.SecurityException: That assembly does not allow partially trusted callers.

I developed a web site using .net 2.0, mysql 4.0 and IIS 5.0. The server is hosted by a third party.

I am using the MySql.Data.dll library version 5.0.7.0 to connect to the database. I did not create any custom assembly and I am using the MySqlData objects directly from the code:

using MySql.Data.MySqlClient;


MySqlConnection conn;
MySqlDataAdapter data_retriever;
DataTable TextDataTable;

TextDataTable = new DataTable();

data_retriever = new MySqlDataAdapter(last_query_executed.Value.ToString(), conn);

data_retriever.Fill(TextDataTable);

This is the error I get:

System.Security.SecurityException: That assembly does not allow partially trusted callers.

[SecurityException: That assembly does not allow partially trusted callers.]
search_search.BindData() +0
search_search.Page_Load(Object sender, EventArgs e) +30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6978
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.search_search_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

My level of knowledge of .NET and Visual Studio is not advanced.

Do you have any suggestions?

Thanks,

Christian

Here is a post on the issue. It seems the current server configuration does not allow partial trusted callers.

http://bloggingabout.net/blogs/rick/archive/2006/04/07/11929.aspx -- this may not really apply becaus eyour site is hosted by a 3rd party

http://forums.mysql.com/read.php?38,95478,96748#msg-96748 -- has a link to download a new version of MySql assembly allowing partial trust. Not sure it will work, mixed results

http://forums.asp.net/t/999456.aspx -- has some other solutions. One of which is using a ODBC connection to MySql instead.

http://dev.mysql.com/tech-resources/articles/dotnet/ --see for ODBC driver details


I tried to recompile the library. However, I get a compilation error after I add the following line in the Assemplyinfo.cs:

[assembly: AllowPartialllyTrustedCallers]

Any ideas?

Christian


What error did you get? Also post your AssemblyInfo.cs file.


I fixed this problem, I was missing the following line:

using

System.Security;

however, now i am getting the error:

Unable to connect to any of the specified MySQL hosts.