Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2008, 08:00 AM
Registered User
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default CreateUserWizard FileIOPermission Error

My users are getting a FileIOPermission Security Exception when they try to create new login accounts on a website I created based on The Beer House application.

The CreateUserWizard worked fine until I had to switch to a new provider under a shared hosting environment. I suspect it may be an issue with trying to read the text file specified in the BodyFileName attribute of the MailDefinition when sending a confirmation email to the user.

But the file can be read when you try to access it directly (http://lwa.pryzm.net/RegisterConfirm.txt), so why wouldn't the CreateUserWizard be able to read it as well? Does this control attempt to WRITE to the file system at any point???

The same thing also happens with the built-in ASP.NET controls to change your password or recover a lost password. If anyone could share any insight on this it would be greatly appreciated!


The details of the error are:


Server Error in '/lwa' Application.
--------------------------------------------------------------------------------

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.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:


[No relevant source lines]


Source File: App_Web_tx-riydv.0.cs Line: 0

Stack Trace:


[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Obj ect demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +59
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +678
   System.IO.FileStream..ctor(String path, FileMode mode) +65
   System.Net.Mail.SmtpClient.GetFileMailWriter(Strin g pickupDirectory) +234
   System.Net.Mail.SmtpClient.Send(MailMessage message) +2004
   System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +341
   System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser() +571
   System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs e) +105
   System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +453
   System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(Object source, EventArgs e) +149
   System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +17
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   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(Http Context context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.register_aspx.ProcessRequest(HttpContext context) in App_Web_tx-riydv.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +303
   System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +64




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
 
Old April 7th, 2008, 11:50 AM
Registered User
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I finally figured out what was causing this. The smtp deliveryMethod in web.config on the live server accidentally got set to "PickupDirectoryFromIis" (used for local development) instead of "Network" (used on the production site).

So the file error had nothing to do with the BodyFileName property. It occurred because the web application did not have permission to write to the <drive>:\Inetpub\mailroot\Queue IIS folder when it was trying to queue up the email message to be sent.

DOH!... :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateUserWizard AghaKhan ASP.NET 2.0 Professional 1 December 5th, 2007 08:14 PM
CreateUserWizard michaelcode ASP.NET 2.0 Basics 2 February 5th, 2007 06:17 PM
CreateUserWizard elavio ASP.NET 2.0 Basics 1 November 18th, 2006 07:50 PM
CreateUserWizard michaelcode ASP.NET 2.0 Basics 1 August 19th, 2006 09:04 AM
CreateUserWizard zoltac007 ASP.NET 2.0 Basics 4 June 1st, 2006 04:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.