mysterious error:

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?
 
G

George Ter-Saakov

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?
 
L

Lloyd Dupont

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top