some problem when site is uplodedhttp://forums.asp.net/t/1397142.aspx/1?some+problem+when+site+is+uplodedFri, 20 Mar 2009 02:51:45 -040013971423008047http://forums.asp.net/p/1397142/3008047.aspx/1?some+problem+when+site+is+uplodedsome problem when site is uploded <p>&nbsp;Hello ,</p> <p>I have a hosting a/c with go daddy , and my one site is running&nbsp; fine in local but after uploading it is not working and shows some error like</p> <p><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><b>Exception Details: </b>System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</font> </p> <table width="719" border="0" cellpadding="0" cellspacing="0" height="17" style="table-layout:fixed"> <tbody> <tr> <td> <p>&nbsp;</p> <p style="text-decoration:underline"><b>when i tried to take help from godaddy there response was like as :</b> </p> <p>&nbsp;</p> <p><font color="#434068"><b></p> <p>&quot; Please note, the error you have received is an error regarding your permissions. Trust level refers to permissions set in the Web.config file that dictate what operations can and cannot be performed by Web applications. Our <span alt="The Microsoft scripting language, ASP or ASP.NET is used in building dynamic websites. Typically sites with ASP are compatible with Windows accounts."> ASP</span>.NET 3.5 <span alt="Shared Hosting is the allocation of small pieces of a server's storage, applications and bandwidth for unique users."> shared hosting</span> servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission, and a less-restrictive WebPermission.</p> <p>Applications operating under a Medium trust level have no <span alt="A Registry is a database associating DNS information with an individual, a legal entity or operational entity."> registry</span> access, no access to the Windows event log, and cannot use ReflectionPermission (but can use Reflection). Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy.</p> <p>Using a Medium trust level prevents applications from accessing shared system resources and eliminates the potential for application interference. Adding OleDbPermission and OdbcPermission allows applications to use those data providers to access databases. WebPermission is modified to allow outbound <span alt="HTTP or Hypertext Transfer Protocol is the set of regulations for making the transfer of files on the World Wide Web."> http</span> and https traffic.&quot;</p> <p>&nbsp;</p> </b></font> <p></p> &lt;div style=&quot;margin-left: 40px;&quot;&gt;<font color="#434068"><b> <p>&nbsp;</p> </b></font>&lt;/div&gt; <p><font color="#434068"><b></p> <p><span style="font-weight:normal">I did not understand this mail . Please&nbsp; anybody help me how to solve this issue.&nbsp; how to do it ?</span></p> <p><span style="font-weight:normal">link of&nbsp; the site is&nbsp; www.agarwalmilan.com </span> </p> <p><span style="font-weight:normal">Thank you very much</span><br> </p> </b></font> <p></p> </td> </tr> </tbody> </table> 2009-03-15T09:35:07-04:003008147http://forums.asp.net/p/1397142/3008147.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>&nbsp;First of all tell us, what are you doing in your code, which is making this error come? Are you saving/uploading some file on your hosting OR something else? <br> </p> 2009-03-15T12:20:21-04:003008155http://forums.asp.net/p/1397142/3008155.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>i am doing nothing . i made an web site then i published it and uploded it to my hosting which is in go daddy. thats it , and it is running fine in the local and&nbsp;published files are also running fine in the local,</p> <p>BUT when i upload it there an error comes. site name is</p> <p>&nbsp;<a href="http://www.agarwalmilan.com/">www.agarwalmilan.com</a></p> 2009-03-15T12:27:20-04:003008171http://forums.asp.net/p/1397142/3008171.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>You are using godaddy right?</p> <p>Are you sure, you have set the directory as application root while creating virtual directory. Moreover, check the permissions on the folder you have your website in.<br> </p> 2009-03-15T12:37:59-04:003008176http://forums.asp.net/p/1397142/3008176.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>OK, this is a trick but do save a copy of your web.config before applying this trick</p> <p>in your webconfig whereever you can find the version number as b77a5c561934e089,<br> change it to B77A5C561934E089</p> <p>and upload it on the server. Lets see if it works. <br> </p> 2009-03-15T12:42:47-04:003008206http://forums.asp.net/p/1397142/3008206.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded i have not found these number in my web.config 2009-03-15T13:14:39-04:003008225http://forums.asp.net/p/1397142/3008225.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>There are always some assemblies having these Version Numbers in Web.Config. But Anyway, try these.<br> </p> <p>1. Is there any other page in your application. Try accessing that. Does the same error coming there?</p> <p>2. In your default.aspx, if you have any control validators, then just comment them. Then try to upload the same and try again.<br> </p> <p>&nbsp;</p> 2009-03-15T13:34:05-04:003008245http://forums.asp.net/p/1397142/3008245.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>i tried that</p> <p><a href="http://www.agarwalmilan.com/Default.aspx">http://www.AgarwalMilan.com/Default.aspx</a></p> <p>but sorry, the same error comes</p> <p>have u read out the mail that i got from my hosting company,</p> <p>&nbsp;it was in my first post&nbsp; within quotation &quot; &quot; mark. </p> <p>please read out that</p> 2009-03-15T13:50:41-04:003008264http://forums.asp.net/p/1397142/3008264.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>I have read there response and I am not amazed by it. I was aking you to check any other file other than default.aspx if you have any. Like register.aspx or something like that. Also, try by removing the Validation controls like requiredfieldvalidator or rangevalidator for a moment. <br> </p> 2009-03-15T14:07:17-04:003008290http://forums.asp.net/p/1397142/3008290.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>&nbsp;yes i have also done that&nbsp; but the same error comes.<br> </p> 2009-03-15T14:21:26-04:003015712http://forums.asp.net/p/1397142/3015712.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>Hi,</p> <p>The error message indicates that your website doesn't have rights to access the file on server. </p> <p>As mentioned above, your host server uses Medium trust level to restrict which resource types your application can access and which privileged operations it can perform. So your website only can access the file in its &#36;AppDir&#36; (application folder on host server). </p> <p>During development in local, the code access security is Full trust level and application can implement more works. For testing, you can run your website with Medium trust level in local. I think we will get the same issue.</p> <p>&lt;system.web&gt;<br> &nbsp; ...<br> &nbsp; &lt;trust level=&quot;Medium&quot; /&gt;<br> &nbsp; ...<br> &lt;/system.web&gt;<br> </p> <p>You also can create simple web application and then upload it to server.</p> <p>In this case, please make sure your website doesn't use the file that is outside of&nbsp;website folder.</p> <p>For more information, see <a href="http://msdn.microsoft.com/en-us/library/ms998326.aspx"> http://msdn.microsoft.com/en-us/library/ms998326.aspx</a>&nbsp;(Typically, Table 4: Default ASP.NET Policy Permissions and Trust Levels).</p> <p>&nbsp;</p> <p>I look forward to receiving your test results. </p> <p><br> &nbsp;</p> 2009-03-18T08:50:37-04:003016095http://forums.asp.net/p/1397142/3016095.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>&nbsp;You are absolutley right mr. Thomas</p> <p>My hosting only provides medium trust level . But the thing is that i am not trying to access any file outside the application folder . so i am surprised .</p> <p>My site has been finished now in local , so please let me know how to converet it under medium trust section. and how i can find that which line of code trying to acces the file from outside the appliaction. <br> </p> 2009-03-18T10:53:26-04:003018671http://forums.asp.net/p/1397142/3018671.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>Hi,</p> <p>Thanks for your response.</p> <p>For testing, you can run your website with Medium trust level in local IIS.</p> <p>&lt;system.web&gt;<br> &nbsp; ...<br> &nbsp; &lt;trust level=&quot;Medium&quot; /&gt;<br> &nbsp; ...<br> &lt;/system.web&gt;</p> <p>Does your application need to implement special tasks or you will grant other permissions to it?&nbsp;We need to sure&nbsp;your application can be running under&nbsp;Medium trust level by default configuration before uploading it to host&nbsp;server.</p> <p>&nbsp;</p> <p>Thanks.</p> <p>&nbsp;</p> 2009-03-19T04:03:59-04:003019240http://forums.asp.net/p/1397142/3019240.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>yes <strong>Dear Thomas, </strong>m trying , i will let u know when the problem will be solved.<br> </p> 2009-03-19T07:59:42-04:003020685http://forums.asp.net/p/1397142/3020685.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>&nbsp;hello thomas</p> <br> <p>Thanks for the support. I think i have found the error actually there is a line of code which might be causing error.</p> <p>and the line is :</p> <p><b>&nbsp;This&nbsp; .cs file is in the my application APP_code folder</b><br> </p> <p>&nbsp;// Get the Web application configuration.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Configuration configuration = WebConfigurationManager.OpenWebConfiguration(&quot;~&quot;);<br> <br> // Get the 'pages' section.<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PagesSection pagesSection = (PagesSection)configuration.GetSection(&quot;system.web/pages&quot;);</p> <p>what path i should use in place of this tilde sign to get the web application configuration file </p> <p>thanks <br> </p> <p>&nbsp;</p> <p>&nbsp;</p> 2009-03-19T15:55:27-04:003022130http://forums.asp.net/p/1397142/3022130.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>TRY THIS</p> <p>WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)</p> <p>Request.ApplicationPath will bring the correct application path for the web.config file, if the Requested page and web.config is in the same directory. Otherwise it may give error. <br> </p> 2009-03-20T02:11:45-04:003022199http://forums.asp.net/p/1397142/3022199.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>&nbsp;it gives the same error<br> </p> 2009-03-20T02:49:01-04:003022204http://forums.asp.net/p/1397142/3022204.aspx/1?Re+some+problem+when+site+is+uplodedRe: some problem when site is uploded <p>Hi,</p> <p><em>To obtain the Configuration object for a resource, your code must have read privileges on all the configuration files from which it inherits settings</em>. In this case, your website is running Medium level so it doesn't have permission&nbsp;in inherits settings.</p> <p>For more information, see <a href="http://msdn.microsoft.com/en-us/library/ms151456.aspx"> http://msdn.microsoft.com/en-us/library/ms151456.aspx</a></p> <p>In this case, you can treat the website's web.config as XML file and use XmlDocument class (<a href="http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx">http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx</a>) to access it.&nbsp;&nbsp;&nbsp;&nbsp;</p> <p>&nbsp;</p> <p>Thanks.</p> 2009-03-20T02:51:45-04:00