Configuration :: Logging SMTP Session In Medium Trust?
Jan 23, 2011
I have a script that send a daily email to a list of recipients from a database. I am having a couple of emails failing to send and the try/catch/ex.message & ex.stacktrace doesn't give me enough information to show what the actual problem is. I have tried to do some smtp session logging but that seems to not be doable since I am running under Medium trust. Is their either another way to get this code to work on medium trust or another way to get detailed SMTP log info.
I have some inherited code which stores SMTP server, username, password in the system.net/mailSettings/smtp section of the Web.config.
It used to read them like so:
Configuration c = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)c.GetSectionGroup("system.net/mailSettings"); return settings.Smtp.Network.Host;
But this was failing when I had to deploy to a medium trust environment. So following the answer from this question, I rewrote it to use GetSection() like so:
Is it possible to get session cookie name in medium trust level? The code below works in full trust, but throws a security exception in medium trust level.
My hosting provider just changed the trust level to medium but I cant figureout where to place the configuration on the web.config file! I have spent hours trying to figureout with no luck. here my web.config file
Web hosting provider has set the .net trust level as Medium. so report viewer & crystal reports are not working. it required full trust.so is it possible to execute the reports in medium trust? and how?
ReportDoc.Load(Server.MapPath("~/Reports/Proposal.rpt")); DataTable dt = cm.DisplayUserInfo("select * from tblProposal_Master where proposal_id='000006'").Tables[0]; ReportDoc.SetDataSource(dt); CRV.ReportSource = ReportDoc; CRV.DataBind();
I have to host a wcf service in a medium trust environment.I want to know which bindings are supported while hosting WCF services in medium trust. There is a MSDN article
http://msdn.microsoft.com/en-us/library/bb412171.aspx which talks about partial trust. I am not sure is it the same as medium trust.
Im running an ASP.NET MVC application hosted with Mosso, there are telling me that they cannot enable DTC because they run everything in medium trust.So when executing code that references: TransactionScope I get the following error. The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
what Medium Trust level is ?And what does it mean :
"More and more ASP.NET hosting providers are enforcing a Medium Trust Policy on their servers.Therefore it is important to make your website work (as much as possible) in environments where medium trust is enforced."
I am using GhostScript to generate some thumbnails of PDF pages in an ASP.NET application. I have it wrapped in this library called GhostScriptSharp that just uses DllImport to call methods in the GhostScript DLL.It looks like this wont work on a medium trust hosting environment, either because of the fact that it is calling unmanaged code, or that it looks like the library is creating files all over the place (outside my virtual directory). I ran Process Monitor and saw it trying to Read, QueryNameInformationFile, CreateFile and QueryStandardInformationFile in places like:
C:WINDOWSsystem32HalftoneDefault or C:gsgs8.63libHalftoneDefault or C:gsfontHalftoneDefault
Any ideas about whether this is "fixable" to run in medium trust? If I can't use GhostScript, is there another free/open source library that WILL work in Medium trust?
I am trying to get a simple prototype using ASP.NET S#arp-architecture (Sharp architecture) to run on a shared hosting site. This site runs in medium trust, which appears to give problems with this framework. At first I went off on a wild goose chase with the mySQL.data.dll, but the latest version already supports partially trusted callers. The only way I found up until now is this blogpost, which basically describes re-compiling everything from the ground up, starting with the various Castle components. Is this the only way to get this to work, and more importantly, does this actually work?
I have had some good experiences with S#arp-architecture, and since I only have a few days to build this prototype, I figured S#arp-architecture would be a good match. So, my options are to stick with SA, or on the other end of the spectrum to hand-roll an MVC/NH/mySQL application.
I'm following this document in order to run my website in a medium trust environment. My web app uses OleDb, so I need to give it permission in medium trust. I've done everything that is in that article and it's still not working In my web_mediumtrust.config I've added the following security class:
I'm building an ASP.NET MVC site where I want to use OpenSTV to conduct polls. To run results through OpenSTV, I'd have to run the executable. Is that allowed from a medium-trust ASP.NET application?
I need to generate PDF reports on a server where full trust apps cannot run.(i cannot use PdfSharp and MigraDoc because of security exceptions when i say
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always); renderer.Document = doc; renderer.RenderDocument(); // <<< ex here renderer.PdfDocument.Save(filePath);
Message: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.so i need to have asp.net c# pdf generator that runs on Medium Trust or Low trust OR be able to pass values from asp.net c# to any php pdf generator.I am trying itextsharp-5.0.5,
Together with Ben (@BuildStarted), we've been building the RazorEngine project, which is designed to allow you compile and parse arbitrary templates outside of ASP.NET MVC. The project has had a couple of releases for a while now, and the feedback has been greatBut, we have encountered an issue: Medium trust.
Because we are using the CSharpCodeProvider to compile the Razor-generated classes (to load into the current AppDomain for execution), we encounter a SecurityException when trying to invoke it, due to the LinkDemand enforced on it. When a normal ASP.NET page is compiled (regardless of trust level), it does so through a BuildProvider which is normally GAC'd, and thus is implicity granted the appropriate permissions to compile. Hence ASP.NET WebForms works as standard in Medium trust.
Our code does not, and we need to target scenarios where our built library won't be deployed to the GAC and is running in Medium trust. So we considered building a BuildProvider specifically for it and defer compilation to the ASP.NET build system, but this seems overly complex and disjointed, and the provider itself requires both a mapping through a file extension, and a virtual path (which may or may not resolve to a physical file - think VirtualPathProvider). It all seems overkill, just to get the project working in Medium trust; not just that, but purely for ASP.NET projects as our engine also works outside of ASP.NETSo my question is this, does anyone know of any techniques or technologies for compiling C# code in a Medium trust environment?
I need to load an xML file from the bin folder in ASP.NET (MVC, not that it would count). I can't get the bin folder path nor load the file otherwise.. I need to feed the following method :
I'm trying to get the entity framework working in medium trust. I've tried splitting the files and using a separate assembly but I seem to have one problem after another.I moved the EDMX to a separate assembly, which causes a single .dll to be outpit to the sites /Bin directory. I'm referencing this as below from web.config.
Whenever I try to access one of the entity classes, I get an ArgumentException: 'An item with the same key has already been added.' It's critical this works with medium trust, but I seem to be running out of options.
I'm doing shared hosting with GoDaddy and I developed a sample ASP.NET MVC app using Castle Windsor and unfortunately, it didn't work in a medium trust setting. Specifically, I got this error: "[SecurityException: That assembly does not allow partially trusted callers"... etc. GoDaddy is sadly not flexible in their trust policy.
I'm not tied to Windsor and would like to try another one that will work under Medium Trust. I'd actually like to use NInject, but I've read people having mixed success. The only one I've read that works with no problem is Microsoft's Unity.My question is, does NInject work in medium trust? If not, what are my options?
I am trying to use SqlCacheDependency in my web site.I got in touch with my hosting compnay and they said that they support cache but they set the trust level to medium and what I try to do needs full trust level whihch they cannot provide for me.
can someone show me a way or a code samples that use SqlCacheDependency with medium level trust?
the broker is enabled in the hosting sql server
this code raise the error that the hosting providers said that they cannot support in medium level:
I download a webchart.dll file and used it in my application. Everything went right on my local machine. But issue came when i uploaded the file on the server. I am getting trust level medium issue. The assesmbly doesnot run on medium trust level. How can i run assembly in medium trust level.
My web application is composed of several Visual Studio projects. It currently runs fine under high trust level (<trust level = "High" />). When I try to run it under medium trust level, I get this error:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.