mysterious error:

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I have some work which works well on my computer.
developed with VS.NET 2005 and its embeded web server.
Today (for the 1st time in many years, yeah!) I tried an upgrade of my website.

I have many problem, which I don't have on my computer :-(

for exemple, the simple handler (below) work well locally while it doesn't work on the remote server.
Even though I set Full permission to read/write/execute/killmartian/other for the ASPNET process on the App_Data folder, this handler:
=======
<%@ WebHandler Language="C#" Class="test" %>

using System;
using System.IO;
using System.Web;

public class test : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
string file = HttpContext.Current.Server.MapPath("~/App_Data/testfile.txt");
using (StreamWriter sw = new StreamWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write)))
sw.WriteLine("That did work!");

context.Response.ContentType = "text/plain";
context.Response.Write("That did work!");
}

public bool IsReusable { get { return false; } }
}
=======
Fail with error:
'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.

[UnauthorizedAccessException: Access to the path 'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2014243
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) +998
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +57
test.ProcessRequest(HttpContext context) in c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\test.ashx:12

Any ideas?
This is excruciatingly painful!

Or maybe you could suggest me a good (and not too expensive) ASP.NET2.0 webserver provider?
 
I would suggest to drop the support of Webhost4life a line.
They were very helpful to me when I had a permission problem.

Although you gave full access to the folder you still might not have access to the file in that folder. It's easy to fix by setting flag on a folder level so every subfolder/file will inherit permissions.


George.
I have some work which works well on my computer.
developed with VS.NET 2005 and its embeded web server.
Today (for the 1st time in many years, yeah!) I tried an upgrade of my website.

I have many problem, which I don't have on my computer :-(

for exemple, the simple handler (below) work well locally while it doesn't work on the remote server.
Even though I set Full permission to read/write/execute/killmartian/other for the ASPNET process on the App_Data folder, this handler:
=======
<%@ WebHandler Language="C#" Class="test" %>

using System;
using System.IO;
using System.Web;

public class test : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
string file = HttpContext.Current.Server.MapPath("~/App_Data/testfile.txt");
using (StreamWriter sw = new StreamWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write)))
sw.WriteLine("That did work!");

context.Response.ContentType = "text/plain";
context.Response.Write("That did work!");
}

public bool IsReusable { get { return false; } }
}
=======
Fail with error:
'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.

[UnauthorizedAccessException: Access to the path 'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2014243
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) +998
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +57
test.ProcessRequest(HttpContext context) in c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\test.ashx:12

Any ideas?
This is excruciatingly painful!

Or maybe you could suggest me a good (and not too expensive) ASP.NET2.0 webserver provider?
 
Yep, they did fix it!
I would suggest to drop the support of Webhost4life a line.
They were very helpful to me when I had a permission problem.

Although you gave full access to the folder you still might not have access to the file in that folder. It's easy to fix by setting flag on a folder level so every subfolder/file will inherit permissions.


George.
I have some work which works well on my computer.
developed with VS.NET 2005 and its embeded web server.
Today (for the 1st time in many years, yeah!) I tried an upgrade of my website.

I have many problem, which I don't have on my computer :-(

for exemple, the simple handler (below) work well locally while it doesn't work on the remote server.
Even though I set Full permission to read/write/execute/killmartian/other for the ASPNET process on the App_Data folder, this handler:
=======
<%@ WebHandler Language="C#" Class="test" %>

using System;
using System.IO;
using System.Web;

public class test : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
string file = HttpContext.Current.Server.MapPath("~/App_Data/testfile.txt");
using (StreamWriter sw = new StreamWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write)))
sw.WriteLine("That did work!");

context.Response.ContentType = "text/plain";
context.Response.Write("That did work!");
}

public bool IsReusable { get { return false; } }
}
=======
Fail with error:
'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.

[UnauthorizedAccessException: Access to the path 'c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\App_Data\testfile.txt' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2014243
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) +998
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +57
test.ProcessRequest(HttpContext context) in c:\hosting\webhost4life\member\lloydd\TheCooksCompanion\test.ashx:12

Any ideas?
This is excruciatingly painful!

Or maybe you could suggest me a good (and not too expensive) ASP.NET2.0 webserver provider?
 
Back
Top