Showing posts with label created. Show all posts
Showing posts with label created. Show all posts

Monday, March 26, 2012

periodic check for records to print

Every 10 seconds I need to search a SQL table for orders to print. The order
s
are created through WebForms on ASP.NET clients. The orders should not print
until
10 minutes before they are due.
The network printer will be available from the server running IIS and SQL
Server 2000.
If this were a Windows Forms application, then I would create a system timer
in Form1.Load(). How is this done in an ASP.NET application?Just a note of caution. Writing windows services can be tricky, so just be
prepared to possibly have to spend a little time with it. Debugging is a
little more complex and awkward.
Terry Burns
http://TrainingOn.net
"Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> You should separate the printing function from the rest of your ASP.NET
> forms
> application. The purpose of a web application is to deliver data over
> HTTP
> protocol using an HTTP client (browser). The application you described is
> most suitable for a service, i.e., create a windows service, that runs on
> your web (or any other) server connected to the desired printer.
> For detailed documentation on how to create a Windows Service:
> http://msdn.microsoft.com/library/d...r />
ations.asp
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
>
Thanks for the advice to separate the printing function. I am a little
familiar with the service programming model. The last service I wrote was fo
r
NT 3.51 many many moons ago. I remember some limitations to accessing the GD
I
and databases.
My printing function must connect and access data on SQL Server and then
print. I read through the information at the url that Phillip provided and
all of the other pages in that section. I stll have a couple questions
remaining:
Is there tech support that documents the .NET namespaces that can be used
inside a windows service?
Can I use the ADO.NET functions inside a windows service?
Can I print a crystal report from a windows service,
or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
method from a windows service?
"Terry Burns" wrote:

> Just a note of caution. Writing windows services can be tricky, so just be
> prepared to possibly have to spend a little time with it. Debugging is a
> little more complex and awkward.
> --
> Terry Burns
> http://TrainingOn.net
> "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
>
>
Hi Tony,
As long as the PC that will run the server has the .net framework installed
then all of the functions that you listed will be available to the Windows
Service, as it would to any desktop application. The main difference betwee
n
the Windows Service and the desktop application is that in the former you
would not display a GUI that requires user input.
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tony" wrote:
> Thanks for the advice to separate the printing function. I am a little
> familiar with the service programming model. The last service I wrote was
for
> NT 3.51 many many moons ago. I remember some limitations to accessing the
GDI
> and databases.
> My printing function must connect and access data on SQL Server and then
> print. I read through the information at the url that Phillip provided and
> all of the other pages in that section. I stll have a couple questions
> remaining:
> Is there tech support that documents the .NET namespaces that can be used
> inside a windows service?
> Can I use the ADO.NET functions inside a windows service?
> Can I print a crystal report from a windows service,
> or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
> method from a windows service?
> "Terry Burns" wrote:
>
sorry for couple w delay as I moved from design to implementation ...
Now I have created my windows service
The printdocument.print function is NOT firing the printPage event.
I am using several eventlog.WriteEntry() statements to know how my program
is working and which functions are called. The structure of the program is
similar to the example in the PrintDocument Class documentation.
There is no microsoft.public.dotnet.service group, so I am not sure if this
dotnet.framework.aspnet group is the proper place to continue this discussio
n.
I will post the question again at microsoft.public.dotnet.framework and
include my source code.
btw, the data entry web pages are working very nicely...
"Phillip Williams" wrote:
> Hi Tony,
> As long as the PC that will run the server has the .net framework installe
d
> then all of the functions that you listed will be available to the Windows
> Service, as it would to any desktop application. The main difference betw
een
> the Windows Service and the desktop application is that in the former you
> would not display a GUI that requires user input.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
>
Found a caution from Microsoft not to do this.
"Classes within the System.Drawing.Printing namespace are not supported for
use within a Windows service or ASP.NET application or service. Attempting t
o
use these classes from within one of these application types may produce
unexpected problems, such as diminished service performance and run-time
exceptions.
"
found it at
http://windowssdk.msdn.microsoft.co...ng_printing.asp
"Tony" wrote:
> sorry for couple w delay as I moved from design to implementation ...
> Now I have created my windows service
> The printdocument.print function is NOT firing the printPage event.
> I am using several eventlog.WriteEntry() statements to know how my program
> is working and which functions are called. The structure of the program is
> similar to the example in the PrintDocument Class documentation.
> There is no microsoft.public.dotnet.service group, so I am not sure if thi
s
> dotnet.framework.aspnet group is the proper place to continue this discuss
ion.
> I will post the question again at microsoft.public.dotnet.framework and
> include my source code.
> btw, the data entry web pages are working very nicely...
> "Phillip Williams" wrote:
>

periodic check for records to print

Every 10 seconds I need to search a SQL table for orders to print. The orders
are created through WebForms on ASP.NET clients. The orders should not print
until
10 minutes before they are due.

The network printer will be available from the server running IIS and SQL
Server 2000.

If this were a Windows Forms application, then I would create a system timer
in Form1.Load(). How is this done in an ASP.NET application?Just a note of caution. Writing windows services can be tricky, so just be
prepared to possibly have to spend a little time with it. Debugging is a
little more complex and awkward.

--
Terry Burns
http://TrainingOn.net

"Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> You should separate the printing function from the rest of your ASP.NET
> forms
> application. The purpose of a web application is to deliver data over
> HTTP
> protocol using an HTTP client (browser). The application you described is
> most suitable for a service, i.e., create a windows service, that runs on
> your web (or any other) server connected to the desired printer.
> For detailed documentation on how to create a Windows Service:
> http://msdn.microsoft.com/library/d...lications .asp
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
>> Every 10 seconds I need to search a SQL table for orders to print. The
>> orders
>> are created through WebForms on ASP.NET clients. The orders should not
>> print
>> until
>> 10 minutes before they are due.
>>
>> The network printer will be available from the server running IIS and SQL
>> Server 2000.
>>
>> If this were a Windows Forms application, then I would create a system
>> timer
>> in Form1.Load(). How is this done in an ASP.NET application?
>>
>
Thanks for the advice to separate the printing function. I am a little
familiar with the service programming model. The last service I wrote was for
NT 3.51 many many moons ago. I remember some limitations to accessing the GDI
and databases.

My printing function must connect and access data on SQL Server and then
print. I read through the information at the url that Phillip provided and
all of the other pages in that section. I stll have a couple questions
remaining:

Is there tech support that documents the .NET namespaces that can be used
inside a windows service?
Can I use the ADO.NET functions inside a windows service?
Can I print a crystal report from a windows service,
or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
method from a windows service?

"Terry Burns" wrote:

> Just a note of caution. Writing windows services can be tricky, so just be
> prepared to possibly have to spend a little time with it. Debugging is a
> little more complex and awkward.
> --
> Terry Burns
> http://TrainingOn.net
> "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> > You should separate the printing function from the rest of your ASP.NET
> > forms
> > application. The purpose of a web application is to deliver data over
> > HTTP
> > protocol using an HTTP client (browser). The application you described is
> > most suitable for a service, i.e., create a windows service, that runs on
> > your web (or any other) server connected to the desired printer.
> > For detailed documentation on how to create a Windows Service:
> > http://msdn.microsoft.com/library/d...lications .asp
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> > "Tony" wrote:
> >> Every 10 seconds I need to search a SQL table for orders to print. The
> >> orders
> >> are created through WebForms on ASP.NET clients. The orders should not
> >> print
> >> until
> >> 10 minutes before they are due.
> >>
> >> The network printer will be available from the server running IIS and SQL
> >> Server 2000.
> >>
> >> If this were a Windows Forms application, then I would create a system
> >> timer
> >> in Form1.Load(). How is this done in an ASP.NET application?
> >>
> >>
>
Hi Tony,

As long as the PC that will run the server has the .net framework installed
then all of the functions that you listed will be available to the Windows
Service, as it would to any desktop application. The main difference between
the Windows Service and the desktop application is that in the former you
would not display a GUI that requires user input.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com

"Tony" wrote:

> Thanks for the advice to separate the printing function. I am a little
> familiar with the service programming model. The last service I wrote was for
> NT 3.51 many many moons ago. I remember some limitations to accessing the GDI
> and databases.
> My printing function must connect and access data on SQL Server and then
> print. I read through the information at the url that Phillip provided and
> all of the other pages in that section. I stll have a couple questions
> remaining:
> Is there tech support that documents the .NET namespaces that can be used
> inside a windows service?
> Can I use the ADO.NET functions inside a windows service?
> Can I print a crystal report from a windows service,
> or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
> method from a windows service?
> "Terry Burns" wrote:
> > Just a note of caution. Writing windows services can be tricky, so just be
> > prepared to possibly have to spend a little time with it. Debugging is a
> > little more complex and awkward.
> > --
> > Terry Burns
> > http://TrainingOn.net
> > "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> > news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> > > You should separate the printing function from the rest of your ASP.NET
> > > forms
> > > application. The purpose of a web application is to deliver data over
> > > HTTP
> > > protocol using an HTTP client (browser). The application you described is
> > > most suitable for a service, i.e., create a windows service, that runs on
> > > your web (or any other) server connected to the desired printer.
> > > > For detailed documentation on how to create a Windows Service:
> > > http://msdn.microsoft.com/library/d...lications .asp
> > > > > --
> > > HTH,
> > > Phillip Williams
> > > http://www.societopia.net
> > > http://www.webswapp.com
> > > > > "Tony" wrote:
> > > >> Every 10 seconds I need to search a SQL table for orders to print. The
> > >> orders
> > >> are created through WebForms on ASP.NET clients. The orders should not
> > >> print
> > >> until
> > >> 10 minutes before they are due.
> > >>
> > >> The network printer will be available from the server running IIS and SQL
> > >> Server 2000.
> > >>
> > >> If this were a Windows Forms application, then I would create a system
> > >> timer
> > >> in Form1.Load(). How is this done in an ASP.NET application?
> > >>
> > >>
sorry for couple week delay as I moved from design to implementation ...
Now I have created my windows service

The printdocument.print function is NOT firing the printPage event.

I am using several eventlog.WriteEntry() statements to know how my program
is working and which functions are called. The structure of the program is
similar to the example in the PrintDocument Class documentation.

There is no microsoft.public.dotnet.service group, so I am not sure if this
dotnet.framework.aspnet group is the proper place to continue this discussion.

I will post the question again at microsoft.public.dotnet.framework and
include my source code.

btw, the data entry web pages are working very nicely...

"Phillip Williams" wrote:

> Hi Tony,
> As long as the PC that will run the server has the .net framework installed
> then all of the functions that you listed will be available to the Windows
> Service, as it would to any desktop application. The main difference between
> the Windows Service and the desktop application is that in the former you
> would not display a GUI that requires user input.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
> > Thanks for the advice to separate the printing function. I am a little
> > familiar with the service programming model. The last service I wrote was for
> > NT 3.51 many many moons ago. I remember some limitations to accessing the GDI
> > and databases.
> > My printing function must connect and access data on SQL Server and then
> > print. I read through the information at the url that Phillip provided and
> > all of the other pages in that section. I stll have a couple questions
> > remaining:
> > Is there tech support that documents the .NET namespaces that can be used
> > inside a windows service?
> > Can I use the ADO.NET functions inside a windows service?
> > Can I print a crystal report from a windows service,
> > or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
> > method from a windows service?
> > "Terry Burns" wrote:
> > > Just a note of caution. Writing windows services can be tricky, so just be
> > > prepared to possibly have to spend a little time with it. Debugging is a
> > > little more complex and awkward.
> > > > --
> > > Terry Burns
> > > http://TrainingOn.net
> > > > "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> > > news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> > > > You should separate the printing function from the rest of your ASP.NET
> > > > forms
> > > > application. The purpose of a web application is to deliver data over
> > > > HTTP
> > > > protocol using an HTTP client (browser). The application you described is
> > > > most suitable for a service, i.e., create a windows service, that runs on
> > > > your web (or any other) server connected to the desired printer.
> > > > > > For detailed documentation on how to create a Windows Service:
> > > > http://msdn.microsoft.com/library/d...lications .asp
> > > > > > > > --
> > > > HTH,
> > > > Phillip Williams
> > > > http://www.societopia.net
> > > > http://www.webswapp.com
> > > > > > > > "Tony" wrote:
> > > > > >> Every 10 seconds I need to search a SQL table for orders to print. The
> > > >> orders
> > > >> are created through WebForms on ASP.NET clients. The orders should not
> > > >> print
> > > >> until
> > > >> 10 minutes before they are due.
> > > >>
> > > >> The network printer will be available from the server running IIS and SQL
> > > >> Server 2000.
> > > >>
> > > >> If this were a Windows Forms application, then I would create a system
> > > >> timer
> > > >> in Form1.Load(). How is this done in an ASP.NET application?
> > > >>
> > > >>
> > >
Found a caution from Microsoft not to do this.
"Classes within the System.Drawing.Printing namespace are not supported for
use within a Windows service or ASP.NET application or service. Attempting to
use these classes from within one of these application types may produce
unexpected problems, such as diminished service performance and run-time
exceptions.
"

found it at
http://windowssdk.msdn.microsoft.co...ng_printing.asp

"Tony" wrote:

> sorry for couple week delay as I moved from design to implementation ...
> Now I have created my windows service
> The printdocument.print function is NOT firing the printPage event.
> I am using several eventlog.WriteEntry() statements to know how my program
> is working and which functions are called. The structure of the program is
> similar to the example in the PrintDocument Class documentation.
> There is no microsoft.public.dotnet.service group, so I am not sure if this
> dotnet.framework.aspnet group is the proper place to continue this discussion.
> I will post the question again at microsoft.public.dotnet.framework and
> include my source code.
> btw, the data entry web pages are working very nicely...
> "Phillip Williams" wrote:
> > Hi Tony,
> > As long as the PC that will run the server has the .net framework installed
> > then all of the functions that you listed will be available to the Windows
> > Service, as it would to any desktop application. The main difference between
> > the Windows Service and the desktop application is that in the former you
> > would not display a GUI that requires user input.
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> > "Tony" wrote:
> > > Thanks for the advice to separate the printing function. I am a little
> > > familiar with the service programming model. The last service I wrote was for
> > > NT 3.51 many many moons ago. I remember some limitations to accessing the GDI
> > > and databases.
> > > > My printing function must connect and access data on SQL Server and then
> > > print. I read through the information at the url that Phillip provided and
> > > all of the other pages in that section. I stll have a couple questions
> > > remaining:
> > > > Is there tech support that documents the .NET namespaces that can be used
> > > inside a windows service?
> > > Can I use the ADO.NET functions inside a windows service?
> > > Can I print a crystal report from a windows service,
> > > or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
> > > method from a windows service?
> > > > "Terry Burns" wrote:
> > > > > Just a note of caution. Writing windows services can be tricky, so just be
> > > > prepared to possibly have to spend a little time with it. Debugging is a
> > > > little more complex and awkward.
> > > > > > --
> > > > Terry Burns
> > > > http://TrainingOn.net
> > > > > > "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> > > > news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> > > > > You should separate the printing function from the rest of your ASP.NET
> > > > > forms
> > > > > application. The purpose of a web application is to deliver data over
> > > > > HTTP
> > > > > protocol using an HTTP client (browser). The application you described is
> > > > > most suitable for a service, i.e., create a windows service, that runs on
> > > > > your web (or any other) server connected to the desired printer.
> > > > > > > > For detailed documentation on how to create a Windows Service:
> > > > > http://msdn.microsoft.com/library/d...lications .asp
> > > > > > > > > > > --
> > > > > HTH,
> > > > > Phillip Williams
> > > > > http://www.societopia.net
> > > > > http://www.webswapp.com
> > > > > > > > > > > "Tony" wrote:
> > > > > > > >> Every 10 seconds I need to search a SQL table for orders to print. The
> > > > >> orders
> > > > >> are created through WebForms on ASP.NET clients. The orders should not
> > > > >> print
> > > > >> until
> > > > >> 10 minutes before they are due.
> > > > >>
> > > > >> The network printer will be available from the server running IIS and SQL
> > > > >> Server 2000.
> > > > >>
> > > > >> If this were a Windows Forms application, then I would create a system
> > > > >> timer
> > > > >> in Form1.Load(). How is this done in an ASP.NET application?
> > > > >>
> > > > >>
> > > > > >

Permission

Hey Guys...
I've created my SmartClient that have to print some text directly to the
printer. To do it, I create a text file and after copy it to the printer.
Perfect... But, I am having some permission problems... Look the error:
The application tried to execute a not permited operation by the security
directive ...
System.Drawing.PrintingPermission, System.Drawing.Version=...
Could someone help me?
Thank'sHi,
I think i already send you chris sells article. you can find your
solution there :
http://msdn.microsoft.com/library/d...y/en-us/dnforms
/html/winforms11122002.asp
and
http://msdn.microsoft.com/msdnmag/i...etSmartClients/
HTH
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Permission

Hey Guys...

I've created my SmartClient that have to print some text directly to the
printer. To do it, I create a text file and after copy it to the printer.
Perfect... But, I am having some permission problems... Look the error:

The application tried to execute a not permited operation by the security
directive ...

System.Drawing.PrintingPermission, System.Drawing.Version=...

Could someone help me?

Thank'sHi,

I think i already send you chris sells article. you can find your
solution there :

http://msdn.microsoft.com/library/d...y/en-us/dnforms
/html/winforms11122002.asp

and

http://msdn.microsoft.com/msdnmag/i...etSmartClients/

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Saturday, March 24, 2012

Permission denied creating directory

Hi,
I have a created a simple file upload asp.net web page which also creates di
rectories on the fly using the following code:
string fullpath = Server.MapPath(".\\..\\..\\" + path);
DirectoryInfo dir = new DirectoryInfo(fullpath);
if(!dir.Exists)
dir.Create();
Now the dir.Create() statement gives me a permission denied. The ASP.NET use
r has been giving full control to the directory and in IIS Admin the directo
ry has write permissions for scripts set. There is no problem in uploading t
he file to an already creat
ed directory which I find extremely weird!
What goes wrong ?
My OS is Windows XP using .NET framework 1.1. All the latest security patche
s are installed.Hi,
Does the "System" account have access?
Cheers,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Hi Christoffer:
One way to trouble shoot these types of problems is to enable auditing
and find out "who" is getting the access denied message.
See:
http://www.pluralsight.com/keith/bo...leauditing.html
and
http://www.pluralsight.com/keith/bo...fileaccess.html
Also, make sure the permissions apply to subfolders - click "Advanced"
and check the "Apply To" column.
HTH,
Scott
http://www.OdeToCode.com
On Mon, 21 Jun 2004 08:25:40 -0700, Christoffer Srensen
<ChristofferSrensen@.discussions.microsoft.com> wrote:

>Hi,
>I have a created a simple file upload asp.net web page which also creates d
irectories on the fly using the following code:
>string fullpath = Server.MapPath(".\\..\\..\\" + path);
>DirectoryInfo dir = new DirectoryInfo(fullpath);
>if(!dir.Exists)
> dir.Create();
>Now the dir.Create() statement gives me a permission denied. The ASP.NET user has b
een giving full control to the directory and in IIS Admin the directory has write pe
rmissions for scripts set. There is no problem in uploading the file to an already c
rea
ted directory which I find extremely weird!
>What goes wrong ?
>My OS is Windows XP using .NET framework 1.1. All the latest security patches are i
nstalled.
"Scott Allen" wrote:

> One way to trouble shoot these types of problems is to enable auditing
> and find out "who" is getting the access denied message.
> See:
> http://www.pluralsight.com/keith/bo...leauditing.html
> and
> http://www.pluralsight.com/keith/bo...fileaccess.html
Thanks for these links.

> Also, make sure the permissions apply to subfolders - click "Advanced"
> and check the "Apply To" column.
I have found what the problem was. The ASPNET user I added was from another
domain. Now I have added the local ASPNET user and it works.
The audit thing really helped. Thank you very much!
Kind regards,
Christoffer S?rensen

Permission denied creating directory

Hi,

I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:

string fullpath = Server.MapPath(".\\..\\..\\" + path);
DirectoryInfo dir = new DirectoryInfo(fullpath);
if(!dir.Exists)
dir.Create();

Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!

What goes wrong ?

My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.Hi Christoffer:

One way to trouble shoot these types of problems is to enable auditing
and find out "who" is getting the access denied message.

See:
http://www.pluralsight.com/keith/bo...leauditing.html
and
http://www.pluralsight.com/keith/bo...fileaccess.html

Also, make sure the permissions apply to subfolders - click "Advanced"
and check the "Apply To" column.

HTH,

--
Scott
http://www.OdeToCode.com

On Mon, 21 Jun 2004 08:25:40 -0700, Christoffer Srensen
<ChristofferSrensen@.discussions.microsoft.com> wrote:

>Hi,
>I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:
>string fullpath = Server.MapPath(".\\..\\..\\" + path);
>DirectoryInfo dir = new DirectoryInfo(fullpath);
>if(!dir.Exists)
> dir.Create();
>Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!
>What goes wrong ?
>My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.
"Scott Allen" wrote:

> One way to trouble shoot these types of problems is to enable auditing
> and find out "who" is getting the access denied message.
> See:
> http://www.pluralsight.com/keith/bo...leauditing.html
> and
> http://www.pluralsight.com/keith/bo...fileaccess.html

Thanks for these links.

> Also, make sure the permissions apply to subfolders - click "Advanced"
> and check the "Apply To" column.

I have found what the problem was. The ASPNET user I added was from another domain. Now I have added the local ASPNET user and it works.

The audit thing really helped. Thank you very much!

Kind regards,

Christoffer S?rensen

Permission denied on a folder

I've created a reporting application at my company. I created a directory in the root virtual directory called ExportTemp for saving graphs and any other temporary file. I gave ASPNET modify permissions on this folder but I still get an error saying that access is denied when the app tries to save a file to the directory. I'm not sure what else to look for.

Try to allow read AND Read&Execute persmissions

HC


Haissam:

Try to allow read AND Read&Execute persmissions

HC

Thanks but I guess I should've said that I gave all permissions except full control.

Wednesday, March 21, 2012

Permissions Problem

Hi

I have created a facility to allow the user to upload an
image file to the webserver. When the user creates the
image for the first time i.e. the image does not exist
within the directory everything works fine. The problem
occurs if my ASP.NET dll tries to delete the file or
overwrite it?

I assume my app will be using the ASPNET account and I
have ensured that this account has full control over the
directories in question etc.

Anyone any thoughts?

Thanks in advance

AndyWhat is the error?

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Andy" <andy@.thecodeclinic.net> wrote in message
news:0e7c01c3b42b$a2d2c020$a501280a@.phx.gbl...
> Hi
> I have created a facility to allow the user to upload an
> image file to the webserver. When the user creates the
> image for the first time i.e. the image does not exist
> within the directory everything works fine. The problem
> occurs if my ASP.NET dll tries to delete the file or
> overwrite it?
> I assume my app will be using the ASPNET account and I
> have ensured that this account has full control over the
> directories in question etc.
> Anyone any thoughts?
> Thanks in advance
> Andy
Whoops!

I have since restarted IIS as well but to no avail??

this is the error generated:-

Source:
CodeClinic.RestWebPort.BusLogic.Image.Save

Exception:
Access to the
path "E:\Inetpub\Poachers\library\dishes\dish_8.jpg" is
denied.

Trace:
at System.IO.__Error.WinIOError(Int32 errorCode,
String str)
at System.IO.FileStream..ctor(String path, FileMode
mode, FileAccess access, FileShare share, Int32
bufferSize, Boolean useAsync, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode
mode)
at System.Web.HttpPostedFile.SaveAs(String filename)
at CodeClinic.RestWebPort.BusLogic.Image.Save(String
file, HtmlInputFile uploadedfile)

>--Original Message--
>What is the error?
>--
>Kevin Spencer
>..Net Developer
>Microsoft MVP
>Big things are made up
>of lots of little things.
>"Andy" <andy@.thecodeclinic.net> wrote in message
>news:0e7c01c3b42b$a2d2c020$a501280a@.phx.gbl...
>> Hi
>>
>> I have created a facility to allow the user to upload
an
>> image file to the webserver. When the user creates the
>> image for the first time i.e. the image does not exist
>> within the directory everything works fine. The problem
>> occurs if my ASP.NET dll tries to delete the file or
>> overwrite it?
>>
>> I assume my app will be using the ASPNET account and I
>> have ensured that this account has full control over
the
>> directories in question etc.
>>
>> Anyone any thoughts?
>>
>> Thanks in advance
>>
>> Andy
>
>.
SORTED!

It seems that under Windows 2003 the process is NOT
running under the ASPNET account but a NETWORK SERVICES
account?

However if this is the case how is it writing the first
file upload successfully to the directory?

weird!

It is now working though, which is nice ;-)

>--Original Message--
>What is the error?
>--
>Kevin Spencer
>..Net Developer
>Microsoft MVP
>Big things are made up
>of lots of little things.
>"Andy" <andy@.thecodeclinic.net> wrote in message
>news:0e7c01c3b42b$a2d2c020$a501280a@.phx.gbl...
>> Hi
>>
>> I have created a facility to allow the user to upload
an
>> image file to the webserver. When the user creates the
>> image for the first time i.e. the image does not exist
>> within the directory everything works fine. The problem
>> occurs if my ASP.NET dll tries to delete the file or
>> overwrite it?
>>
>> I assume my app will be using the ASPNET account and I
>> have ensured that this account has full control over
the
>> directories in question etc.
>>
>> Anyone any thoughts?
>>
>> Thanks in advance
>>
>> Andy
>
>.
There are only 2 possible reasons why your app might be denied access to the
file:

1. It doesn't have the necessary permission
2. The file is in use by an application and locked.

You can easily determine whetyher it's number 2 or not. If you can delete
the file and the app cannot, the problem is number 1. When a file is locked,
even the Administrator group can't delete it.

If the problem is number 1, re-check your permissions. And remember that
Deny permission always overrides Grant. In other words, if you have granted
the user permission, and somewhere else that permission is explicitly
denied, the permission is not granted.

You may also want to make sure that the account you think ASP.Net is running
under is indeed the account it is running under. To do this, just open up
Task Manger, check the Processes tab. The user account under which your
ASP.Net worker process is running will be displayed.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Andy" <andy@.thecodeclinic.net> wrote in message
news:115701c3b431$a6b765a0$a301280a@.phx.gbl...
> Whoops!
> I have since restarted IIS as well but to no avail??
> this is the error generated:-
> Source:
> CodeClinic.RestWebPort.BusLogic.Image.Save
> Exception:
> Access to the
> path "E:\Inetpub\Poachers\library\dishes\dish_8.jpg" is
> denied.
> Trace:
> at System.IO.__Error.WinIOError(Int32 errorCode,
> String str)
> at System.IO.FileStream..ctor(String path, FileMode
> mode, FileAccess access, FileShare share, Int32
> bufferSize, Boolean useAsync, String msgPath, Boolean
> bFromProxy)
> at System.IO.FileStream..ctor(String path, FileMode
> mode)
> at System.Web.HttpPostedFile.SaveAs(String filename)
> at CodeClinic.RestWebPort.BusLogic.Image.Save(String
> file, HtmlInputFile uploadedfile)
>
> >--Original Message--
> >What is the error?
> >--
> >Kevin Spencer
> >..Net Developer
> >Microsoft MVP
> >Big things are made up
> >of lots of little things.
> >"Andy" <andy@.thecodeclinic.net> wrote in message
> >news:0e7c01c3b42b$a2d2c020$a501280a@.phx.gbl...
> >> Hi
> >>
> >> I have created a facility to allow the user to upload
> an
> >> image file to the webserver. When the user creates the
> >> image for the first time i.e. the image does not exist
> >> within the directory everything works fine. The problem
> >> occurs if my ASP.NET dll tries to delete the file or
> >> overwrite it?
> >>
> >> I assume my app will be using the ASPNET account and I
> >> have ensured that this account has full control over
> the
> >> directories in question etc.
> >>
> >> Anyone any thoughts?
> >>
> >> Thanks in advance
> >>
> >> Andy
> >.
Hi Andy,

Thank you for posting to the MSDN newsgroups.

I am glad to know that the problem is resolved. You are right that the
default account is the Network_Service account in Windows 2003 Server (IIS
6). If you want to change the account, please refer to the following
article.

INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/defaul...kb;en-us;306158

If you have any more concerns, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Thanks guys :-)

>--Original Message--
>Hi Andy,
>Thank you for posting to the MSDN newsgroups.
>I am glad to know that the problem is resolved. You are
right that the
>default account is the Network_Service account in
Windows 2003 Server (IIS
>6). If you want to change the account, please refer to
the following
>article.
>INFO: Implementing Impersonation in an ASP.NET
Application
>http://support.microsoft.com/default.aspx?scid=kb;en-
us;306158
>If you have any more concerns, please feel free to let
me know.
>Best regards,
>Jacob Yang
>Microsoft Online Partner Support
>Get Secure! C www.microsoft.com/security
>This posting is provided "as is" with no warranties and
confers no rights.
>.