• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2115
  • Last Modified:

c# Writing to system temp folder?

One of my boss's hosting clients is coming up with an issue on his site.  It seems that whatever web service they are using is causing a permissions issue.  I think they get a list, and export it to XML, and this is where the errors occur.

Can someone point me in the right direction to look through their code?  I don't know C# at all, so any reference to where I should begin looking would help...
0
kevp75
Asked:
kevp75
  • 8
  • 6
  • 3
  • +1
2 Solutions
 
JimBrandleyCommented:
What is the error?
0
 
kevp75Author Commented:
this is the exact error:

System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\4ir2ueu-.0.cs' could not be found
error CS2008: No inputs specified

   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
   at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
   at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings)
   at System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo[] methodInfos)
   at System.Web.Services.Protocols.XmlReturnWriter.GetInitializers(LogicalMethodInfo[] methodInfos)
   at System.Web.Services.Protocols.MimeFormatter.GetInitializers(Type type, LogicalMethodInfo[] methodInfos)
   at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
   at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

0
 
JimBrandleyCommented:
This is a security problem. The the asp.net worker thread does not have write access permission to that directory. You can verify this with FileMon.exe available free from www.SysInternals.com.

Jim
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kevp75Author Commented:
Ok.  So...how/where/what would I look for in the code to prevent this from trying to dump this file in C:\WINDOWS\TEMP
0
 
JimBrandleyCommented:
If you look at the call stack, it appears that there is no user code invoked yet. Try granting write permission to that directory.
0
 
kevp75Author Commented:
can't do it.  Too much of a security risk invloved in letting the users have that kind of access.

There must be something in the code that we can change that will write the file to a different directory rather than the windows\temp directory
0
 
JimBrandleyCommented:
I have not been able to locate a way to do that. Leave the question open for a while, and maybe someone else will see it who knows of a way.
0
 
JimBrandleyCommented:
I'm going to email another expert asking him to take a peek at this one....

Jim
0
 
kevp75Author Commented:
thanks Jim
0
 
JimBrandleyCommented:
He must bee off the air - I'll post a link...
0
 
iHadiCommented:
Hi kevp75

Consider using Isolated storage:
http://msdn2.microsoft.com/en-us/library/bdts8hk0.aspx
0
 
kevp75Author Commented:
for some reason I kind of doubt the host would be willing to do that, however I will mention it to him.

So am I to assume that there is nothing code wise to specify the path where this temporary file will be stored?
0
 
Bob LearnedCommented:
This sounds like a configuration problem.  Is this ASP.NET 2.0 or 1.1?

Bob
0
 
kevp75Author Commented:
.NET 2.0
0
 
Bob LearnedCommented:
Has the hosting company specified custom security attributes for the TEMP directory?

Bob
0
 
kevp75Author Commented:
no.  they are the default
0
 
Bob LearnedCommented:
Does the web service have an application configured through IIS, and is the ASP.NET version 2.0 from the IIS console app?

Bob
0
 
kevp75Author Commented:
sorry for the delay.  You've asked me a question that I cannot answer, and am just waiting on the powers that be to answer....
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 8
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now