Monday, March 26, 2012
This is a basic overall question. Please note I am new
to ASP!
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
Thank you for your help.
Chow Wai<hkhellhkhell@.hotmail.com> wrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegroups.com...
> This is a basic overall question. Please note I am new
> to ASP!
> I am currently running IIS 5/Access 2000/Windows 2000 and
> have developed a web application.
>
> master/detail form, the best way would be to use ASP.net
> to do so.
> 1. is that true?
It is easy with a GridView and DetailsView, so if easy is your criteria for
best, then I would say yes.
> 2. if so, does ASP.net run against Access or SQLServer?
Both.
> 3. what would I need to purchase to emulate this?
Visual Studio, but you can download the free versions to get started:
http://msdn.microsoft.com/vstudio/express/default.aspx
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*********
Think outside of the box!
****************************************
*********
If you have .NET 2.0 (Visual Studio 2005) master forms are supported by
default on it and are basically effortless to implement... ASP.NET can run
against any OLEDB or ODBC database provider or SQL Server Client, as long as
you have the provider installed on the host system (OLEDB Drivers, or ODBC
drivers)
<hkhellhkhell@.hotmail.com> wrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegroups.com...
> This is a basic overall question. Please note I am new
> to ASP!
> I am currently running IIS 5/Access 2000/Windows 2000 and
> have developed a web application.
>
> master/detail form, the best way would be to use ASP.net
> to do so.
> 1. is that true?
> 2. if so, does ASP.net run against Access or SQLServer?
> 3. what would I need to purchase to emulate this?
> Thank you for your help.
> Chow Wai
>
This is a basic overall question. Please note I am new
to ASP!
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
Quote:
Originally Posted by
>From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
Thank you for your help.
Chow Waihkhellhkhell@.hotmail.com wrote:
Quote:
Originally Posted by
This is a basic overall question. Please note I am new
to ASP!
>
Hi, Chow.
Quote:
Originally Posted by
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>
Quote:
Originally Posted by
From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
>
ASP.Net has some really nice features for beginners. If you have a copy
of Visual Web Developer Express
[http://msdn.microsoft.com/vstudio/express/vwd/] you can very quickly
put together a web app without any real need for custom programming.
Have a look at the samples here
[http://msdn2.microsoft.com/en-us/library/stc0szde.asp]
Quote:
Originally Posted by
1. is that true?
It's definitely a pretty good way, and if you're happy with the
defaults provided by Microsoft, you can do it really REALLY easily.
Quote:
Originally Posted by
2. if so, does ASP.net run against Access or SQLServer?
Yes. And Oracle, and MySql, and flat text files if you're so inclined.
Quote:
Originally Posted by
3. what would I need to purchase to emulate this?
>
Nothing! If you've already got Access, that will do nicely as a
database for playing around with. ASP.Net has classes for communicating
with Access out of the box, so you shouldn't have any problems.
Quote:
Originally Posted by
Thank you for your help.
>
One thing, you mention that you've already developed a web
application... waht have you developed, what have you written it in,
and why are you considering ASP.Net to run just a small part of it? Or
have I misunderstood?
Quote:
Originally Posted by
Chow Wai
Scott Mitchell has written some excellent ASP.NET tutorials that
demonstrate how to build master/detail pages:
http://www.asp.net/learn/dataaccess...tabid=63#master
hkhellhkhell@.hotmail.com wrote:
Quote:
Originally Posted by
This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>
Quote:
Originally Posted by
From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
>
Thank you for your help.
>
Chow Wai
<hkhellhkhell@.hotmail.comwrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegro ups.com...
Quote:
Originally Posted by
This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>
Quote:
Originally Posted by
>>From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?
It is easy with a GridView and DetailsView, so if easy is your criteria for
best, then I would say yes.
Quote:
Originally Posted by
2. if so, does ASP.net run against Access or SQLServer?
Both.
Quote:
Originally Posted by
3. what would I need to purchase to emulate this?
Visual Studio, but you can download the free versions to get started:
http://msdn.microsoft.com/vstudio/express/default.aspx
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
If you have .NET 2.0 (Visual Studio 2005) master forms are supported by
default on it and are basically effortless to implement... ASP.NET can run
against any OLEDB or ODBC database provider or SQL Server Client, as long as
you have the provider installed on the host system (OLEDB Drivers, or ODBC
drivers)
<hkhellhkhell@.hotmail.comwrote in message
news:1159516927.801834.168640@.i3g2000cwc.googlegro ups.com...
Quote:
Originally Posted by
This is a basic overall question. Please note I am new
to ASP!
>
I am currently running IIS 5/Access 2000/Windows 2000 and
have developed a web application.
>
Quote:
Originally Posted by
>>From what I have been told, to really emulate a
master/detail form, the best way would be to use ASP.net
to do so.
>
1. is that true?
2. if so, does ASP.net run against Access or SQLServer?
3. what would I need to purchase to emulate this?
>
Thank you for your help.
>
Chow Wai
>
Saturday, March 24, 2012
This page contains both secure and nonsecure items
This has been driving me nuts for months now, if I access my site from IE
https://db.cornwall.gov.uk/PlanningApplications and then hover over one of
the 2-level menus it comes up with the message:
"This page contains both secure and nonsecure items. Do you want to display
the nonsecure items?"
I've confirmed that there are "no" nonsecure items on this site, it works ok
from Firefox but not IE.
Can someone have a look at the site and see if they get the same problem -
it's been driving me crazy - and why does it only come up when hovering over
the menu item?
Thanks all
KevYou'll find all the answers you need at:
http://blogs.msdn.com/jorman/archiv.../06/526087.aspx
it's because the popup is loaded into a non-secure iframe. A solution is
provided at the link above, but for the sake of posterity:
<script runat="server">
protected override void Render(HtmlTextWriter writer)
{
Page.ClientScript.RegisterStartupScript(typeof(Pag e),
"MenuHttpsWorkaround", Menu1.ClientID +
"_Data.iframeUrl='https://myserver/someblankpage.htm';", true);
base.Render(writer);
}
</script
--
http://www.openmymind.net/
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e27gr8$n40$1@.newsfeed.th.ifl.net...
> Hi all
> This has been driving me nuts for months now, if I access my site from IE
> https://db.cornwall.gov.uk/PlanningApplications and then hover over one of
> the 2-level menus it comes up with the message:
> "This page contains both secure and nonsecure items. Do you want to
> display
> the nonsecure items?"
> I've confirmed that there are "no" nonsecure items on this site, it works
> ok
> from Firefox but not IE.
> Can someone have a look at the site and see if they get the same problem -
> it's been driving me crazy - and why does it only come up when hovering
> over
> the menu item?
> Thanks all
> Kev
>
Thanks very much!!
Kev
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Omi3JLHZGHA.4168@.TK2MSFTNGP05.phx.gbl...
> You'll find all the answers you need at:
> http://blogs.msdn.com/jorman/archiv.../06/526087.aspx
> it's because the popup is loaded into a non-secure iframe. A solution is
> provided at the link above, but for the sake of posterity:
> <script runat="server">
> protected override void Render(HtmlTextWriter writer)
> {
> Page.ClientScript.RegisterStartupScript(typeof(Pag e),
> "MenuHttpsWorkaround", Menu1.ClientID +
> "_Data.iframeUrl='https://myserver/someblankpage.htm';", true);
> base.Render(writer);
> }
> </script>
> --
> http://www.openmymind.net/
>
> "Mantorok" <mantorok@.mantorok.com> wrote in message
> news:e27gr8$n40$1@.newsfeed.th.ifl.net...
>> Hi all
>>
>> This has been driving me nuts for months now, if I access my site from IE
>> https://db.cornwall.gov.uk/PlanningApplications and then hover over one
>> of
>> the 2-level menus it comes up with the message:
>>
>> "This page contains both secure and nonsecure items. Do you want to
>> display
>> the nonsecure items?"
>>
>> I've confirmed that there are "no" nonsecure items on this site, it works
>> ok
>> from Firefox but not IE.
>>
>> Can someone have a look at the site and see if they get the same
>> problem -
>> it's been driving me crazy - and why does it only come up when hovering
>> over
>> the menu item?
>>
>> Thanks all
>> Kev
>>
>>
>>
>>
This page contains both secure and nonsecure items
This has been driving me nuts for months now, if I access my site from IE
https://db.cornwall.gov.uk/PlanningApplications and then hover over one of
the 2-level menus it comes up with the message:
"This page contains both secure and nonsecure items. Do you want to display
the nonsecure items?"
I've confirmed that there are "no" nonsecure items on this site, it works ok
from Firefox but not IE.
Can someone have a look at the site and see if they get the same problem -
it's been driving me crazy - and why does it only come up when hovering over
the menu item?
Thanks all
KevYou'll find all the answers you need at:
http://blogs.msdn.com/jorman/archiv.../06/526087.aspx
it's because the popup is loaded into a non-secure iframe. A solution is
provided at the link above, but for the sake of posterity:
<script runat="server">
protected override void Render(HtmlTextWriter writer)
{
Page.ClientScript.RegisterStartupScript(typeof(Page),
"MenuHttpsWorkaround", Menu1.ClientID +
"_Data.iframeUrl='https://myserver/someblankpage.htm';", true);
base.Render(writer);
}
</script>
http://www.openmymind.net/
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e27gr8$n40$1@.newsfeed.th.ifl.net...
> Hi all
> This has been driving me nuts for months now, if I access my site from IE
> https://db.cornwall.gov.uk/PlanningApplications and then hover over one of
> the 2-level menus it comes up with the message:
> "This page contains both secure and nonsecure items. Do you want to
> display
> the nonsecure items?"
> I've confirmed that there are "no" nonsecure items on this site, it works
> ok
> from Firefox but not IE.
> Can someone have a look at the site and see if they get the same problem -
> it's been driving me crazy - and why does it only come up when hovering
> over
> the menu item?
> Thanks all
> Kev
>
>
Thanks very much!!
Kev
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:Omi3JLHZGHA.4168@.TK2MSFTNGP05.phx.gbl...
> You'll find all the answers you need at:
> http://blogs.msdn.com/jorman/archiv.../06/526087.aspx
> it's because the popup is loaded into a non-secure iframe. A solution is
> provided at the link above, but for the sake of posterity:
> <script runat="server">
> protected override void Render(HtmlTextWriter writer)
> {
> Page.ClientScript.RegisterStartupScript(typeof(Page),
> "MenuHttpsWorkaround", Menu1.ClientID +
> "_Data.iframeUrl='https://myserver/someblankpage.htm';", true);
> base.Render(writer);
> }
> </script>
> --
> http://www.openmymind.net/
>
> "Mantorok" <mantorok@.mantorok.com> wrote in message
> news:e27gr8$n40$1@.newsfeed.th.ifl.net...
>
This should be easy, but...
contents page is an .aspx page that queries an MS Access database and dumps
its results into varios Dropdownlists and 1 Listbox. The users would select
from the list then click a button and the Table of Contents is updated
(works perfectly). The problem is that I can not get it to call a page to
the "main" frame. Redirect as I understand it will not redirect to a target
frame. Does anyone know the solution or work around. Keep in mind that it
is vital to refresh the TOC then call the "main" frame page.Thanks anyways, but I found the solution. Inserting javascript into vb
script.
"Mark Sandfox" <NoSpam@.NoSpam.com> wrote in message
news:09gKd.24076$by5.2210@.newssvr19.news.prodigy.c om...
>I have a simple framed site with a Banner, Contents, & Main frames. The
>contents page is an .aspx page that queries an MS Access database and dumps
>its results into varios Dropdownlists and 1 Listbox. The users would
>select from the list then click a button and the Table of Contents is
>updated (works perfectly). The problem is that I can not get it to call a
>page to the "main" frame. Redirect as I understand it will not redirect to
>a target frame. Does anyone know the solution or work around. Keep in
>mind that it is vital to refresh the TOC then call the "main" frame page.
This should be easy, but...
contents page is an .aspx page that queries an MS Access database and dumps
its results into varios Dropdownlists and 1 Listbox. The users would select
from the list then click a button and the Table of Contents is updated
(works perfectly). The problem is that I can not get it to call a page to
the "main" frame. Redirect as I understand it will not redirect to a target
frame. Does anyone know the solution or work around. Keep in mind that it
is vital to refresh the TOC then call the "main" frame page.Thanks anyways, but I found the solution. Inserting javascript into vb
script.
"Mark Sandfox" <NoSpam@.NoSpam.com> wrote in message
news:09gKd.24076$by5.2210@.newssvr19.news.prodigy.com...
>I have a simple framed site with a Banner, Contents, & Main frames. The
>contents page is an .aspx page that queries an MS Access database and dumps
>its results into varios Dropdownlists and 1 Listbox. The users would
>select from the list then click a button and the Table of Contents is
>updated (works perfectly). The problem is that I can not get it to call a
>page to the "main" frame. Redirect as I understand it will not redirect to
>a target frame. Does anyone know the solution or work around. Keep in
>mind that it is vital to refresh the TOC then call the "main" frame page.
>
This shouldn't be this hard
I need to connect a treeview control to and Access database.
It seems that I can only use a site map or a XML file. I cannot
figure out why there is not a choice for any other databases.
I was thinking about using ADO.net code but I wanted to find out if
there is a better way. I am using Visual Web Developer 2008.
Thanks for any help or examples.
TyOn Mar 5, 5:08=A0pm, Ty <tbar...@.lewistownhospital.org> wrote:
> Hello,
> =A0 I need to connect a treeview control to and Access database.
> =A0 It seems that I can only use a site map or a XML file. I cannot
> figure out why there is not a choice for any other databases.
> =A0 I was thinking about using ADO.net code but I wanted to find out if
> there is a better way. I am using Visual Web Developer 2008.
> Thanks for any help or examples.
> Ty
http://forums.asp.net/t/339295.aspx
This type of page is not served.
I am beginning to create my first .net website and am running into a problem. Google provided little help. I tried to access an .asp file within one of my subfolders and am receiving the following error:
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Is it possible to change the web.config or machine.config file to allow access to an .asp page? I'm new to .Net 2.0.
Thanks!
Hi,
do you use windows server 2003 in combination with IIS6? If so you need to know that IIS6, by default, has the settings set to off for serving ASP.NET or classic ASP pages.
Besides that, ASP.NET webforms need to have the extension .aspx, not .asp. This is needed to have IIS use the correct ISAPI filters.
Grz, Kris.
Yes, I'm on a win2003 server with IIS 6. What I'm basically trying to accomplish is create a 2.0 login system to replace our current system. We currently have a lot of sites written in classic asp and a few newer sites written in .NET 2.0. So what I have done is set up a test and everything works well, until I try to access an .asp page inside of one of our sites. I know that webforms need the .aspx extension, but am unsure of how to configure ISAPI or httphandlers to allow the execution of .asp pages. A general diagram of our system is below:
Our_Portal -- main folder, has 2.0 login features with links to the following subfolders/sites
Site_A -- .NET 2.0 site
Site_B -- classic ASP
Site_C -- classic ASP
When I try to access sites B and C, I get the "cannot serve pages" error. Is this more clear?
this.Dropdownlist not working
a
dropdown list by draging it on the page from the toolbar but when typing
this. the dropdown id is not selectable and I can not access any of its
attributes.
--
Paul G
Software engineer.assuming this is 1.x, you'll need to go in our codebehind, expand the
desiner region and add
protected DropDownList controlId;
like
protected DropDownList States;
you should see other similar controls there..
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:BEC317EE-DAEB-4BA7-908A-4036BB9F5CB6@.microsoft.com...
>I added a textbox to a c# page and can access it with code behind but added
>a
> dropdown list by draging it on the page from the toolbar but when typing
> this. the dropdown id is not selectable and I can not access any of its
> attributes.
> --
> Paul G
> Software engineer.
working now, not sure what happened.
--
Paul G
Software engineer.
"Paul" wrote:
> I added a textbox to a c# page and can access it with code behind but adde
d a
> dropdown list by draging it on the page from the toolbar but when typing
> this. the dropdown id is not selectable and I can not access any of its
> attributes.
> --
> Paul G
> Software engineer.
ok thanks for the reply. I thought all of that code was generated
automatically when you put the control on the form.
--
Paul G
Software engineer.
"Karl Seguin [MVP]" wrote:
> assuming this is 1.x, you'll need to go in our codebehind, expand the
> desiner region and add
> protected DropDownList controlId;
> like
> protected DropDownList States;
> you should see other similar controls there..
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:BEC317EE-DAEB-4BA7-908A-4036BB9F5CB6@.microsoft.com...
>
>
Most of the time ;)
Karl
http://www.openmymind.net/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:C3219EE8-856F-4861-8CDA-9E35C46F671E@.microsoft.com...
> ok thanks for the reply. I thought all of that code was generated
> automatically when you put the control on the form.
> --
> Paul G
> Software engineer.
>
> "Karl Seguin [MVP]" wrote:
>
this.Dropdownlist not working
dropdown list by draging it on the page from the toolbar but when typing
this. the dropdown id is not selectable and I can not access any of its
attributes.
--
Paul G
Software engineer.assuming this is 1.x, you'll need to go in our codebehind, expand the
desiner region and add
protected DropDownList controlId;
like
protected DropDownList States;
you should see other similar controls there..
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:BEC317EE-DAEB-4BA7-908A-4036BB9F5CB6@.microsoft.com...
>I added a textbox to a c# page and can access it with code behind but added
>a
> dropdown list by draging it on the page from the toolbar but when typing
> this. the dropdown id is not selectable and I can not access any of its
> attributes.
> --
> Paul G
> Software engineer.
working now, not sure what happened.
--
Paul G
Software engineer.
"Paul" wrote:
> I added a textbox to a c# page and can access it with code behind but added a
> dropdown list by draging it on the page from the toolbar but when typing
> this. the dropdown id is not selectable and I can not access any of its
> attributes.
> --
> Paul G
> Software engineer.
ok thanks for the reply. I thought all of that code was generated
automatically when you put the control on the form.
--
Paul G
Software engineer.
"Karl Seguin [MVP]" wrote:
> assuming this is 1.x, you'll need to go in our codebehind, expand the
> desiner region and add
> protected DropDownList controlId;
> like
> protected DropDownList States;
> you should see other similar controls there..
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:BEC317EE-DAEB-4BA7-908A-4036BB9F5CB6@.microsoft.com...
> >I added a textbox to a c# page and can access it with code behind but added
> >a
> > dropdown list by draging it on the page from the toolbar but when typing
> > this. the dropdown id is not selectable and I can not access any of its
> > attributes.
> > --
> > Paul G
> > Software engineer.
>
Most of the time ;)
Karl
--
http://www.openmymind.net/
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:C3219EE8-856F-4861-8CDA-9E35C46F671E@.microsoft.com...
> ok thanks for the reply. I thought all of that code was generated
> automatically when you put the control on the form.
> --
> Paul G
> Software engineer.
>
> "Karl Seguin [MVP]" wrote:
>> assuming this is 1.x, you'll need to go in our codebehind, expand the
>> desiner region and add
>>
>> protected DropDownList controlId;
>>
>> like
>>
>> protected DropDownList States;
>>
>> you should see other similar controls there..
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>>
>>
>> "Paul" <Paul@.discussions.microsoft.com> wrote in message
>> news:BEC317EE-DAEB-4BA7-908A-4036BB9F5CB6@.microsoft.com...
>> >I added a textbox to a c# page and can access it with code behind but
>> >added
>> >a
>> > dropdown list by draging it on the page from the toolbar but when
>> > typing
>> > this. the dropdown id is not selectable and I can not access any of its
>> > attributes.
>> > --
>> > Paul G
>> > Software engineer.
>>
>>
>
Thursday, March 22, 2012
Thread Abort?
thread that spawned it cannot access it so it must done within the thread.
ChipBest way is probably to have a field visible to the thread thats not
controlled by the async thread and have the asyn thread check if the value
signifies abort. Perhaps a value available in Context, session or
application that the async thread can periodically look at.
Regards
John Timney (MVP)
http://www.johntimney.com
"Chip" <chip@.intradata.comwrote in message
news:%230tC6q21GHA.1268@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
>I need to have an asynch thread abort itself. Something akin to a STOP. The
>thread that spawned it cannot access it so it must done within the thread.
>
Chip
>
This approach has the parent process ending the thread. The test is in the
thread itself so it needed to be a self-abort. There doesn't seem to be a
good way to do it based on what I've been able to research, so since the
easy way out is not there, I restructured the code so I could just use "exit
sub".
Thanks for the reply,
Chip
"John Timney (MVP)" <x_john@.timney.eclipse.co.ukwrote in message
news:ILWdnbZUP7x495XYRVny1Q@.eclipse.net.uk...
Quote:
Originally Posted by
Best way is probably to have a field visible to the thread thats not
controlled by the async thread and have the asyn thread check if the value
signifies abort. Perhaps a value available in Context, session or
application that the async thread can periodically look at.
>
Regards
>
John Timney (MVP)
>
>
http://www.johntimney.com
"Chip" <chip@.intradata.comwrote in message
news:%230tC6q21GHA.1268@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
>>I need to have an asynch thread abort itself. Something akin to a STOP.
>>The thread that spawned it cannot access it so it must done within the
>>thread.
>>
>Chip
>>
>
>
If you abort an asnc thread with something like thread abort I believe it
throws an unhandled exception, which can leave your objects in an ustable
state, hence my suggestion to use a controller value to terminate and exit
the thread cleanly. If you've managed to get it running to exit sub and die
cleanly then stick with it.
Regards
John Timney (MVP)
http://www.johntimney.com
"Chip" <chip@.intradata.comwrote in message
news:%233CJhy31GHA.4392@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
This approach has the parent process ending the thread. The test is in the
thread itself so it needed to be a self-abort. There doesn't seem to be a
good way to do it based on what I've been able to research, so since the
easy way out is not there, I restructured the code so I could just use
"exit sub".
>
Thanks for the reply,
>
Chip
>
>
"John Timney (MVP)" <x_john@.timney.eclipse.co.ukwrote in message
news:ILWdnbZUP7x495XYRVny1Q@.eclipse.net.uk...
Quote:
Originally Posted by
>Best way is probably to have a field visible to the thread thats not
>controlled by the async thread and have the asyn thread check if the
>value signifies abort. Perhaps a value available in Context, session or
>application that the async thread can periodically look at.
>>
>Regards
>>
>John Timney (MVP)
>>
>>
>http://www.johntimney.com
>"Chip" <chip@.intradata.comwrote in message
>news:%230tC6q21GHA.1268@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
>>>I need to have an asynch thread abort itself. Something akin to a STOP.
>>>The thread that spawned it cannot access it so it must done within the
>>>thread.
>>>
>>Chip
>>>
>>
>>
>
>
Thread accessing session variables?
state. How can a thread access Application or Session states? Send it
the httpContext?
Thanks for your help.The httpcontext is owned by the main thread so you will need to send in a
reference to the object to the thread. Here is an example:
function(System.Web.HttpContext Stream)
{
Stream.Response.Write("vlah");
}
call it like so
function(HttpContext.Current);
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Bruce W.1" <no@.direct.email> wrote in message
news:401B0E42.3A4D549E@.direct.email...
> I need to spin of a thread that periodically checks the Application
> state. How can a thread access Application or Session states? Send it
> the httpContext?
> Thanks for your help.
I don't think this will work. If the thread is running separately from the
main Page execution thread, the Page may have already been processed, in
which case the Response and Request would not be available.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:#0T6qXB6DHA.1632@.TK2MSFTNGP12.phx.gbl...
> The httpcontext is owned by the main thread so you will need to send in a
> reference to the object to the thread. Here is an example:
> function(System.Web.HttpContext Stream)
> {
> Stream.Response.Write("vlah");
> }
> call it like so
> function(HttpContext.Current);
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Bruce W.1" <no@.direct.email> wrote in message
> news:401B0E42.3A4D549E@.direct.email...
> > I need to spin of a thread that periodically checks the Application
> > state. How can a thread access Application or Session states? Send it
> > the httpContext?
> > Thanks for your help.
Right. I didn't consider that context. In that case the main thread would
need to wait on the worker thread to be finished.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:OznQqhB6DHA.3308@.TK2MSFTNGP11.phx.gbl...
> I don't think this will work. If the thread is running separately from the
> main Page execution thread, the Page may have already been processed, in
> which case the Response and Request would not be available.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:#0T6qXB6DHA.1632@.TK2MSFTNGP12.phx.gbl...
> > The httpcontext is owned by the main thread so you will need to send in
a
> > reference to the object to the thread. Here is an example:
> > function(System.Web.HttpContext Stream)
> > {
> > Stream.Response.Write("vlah");
> > }
> > call it like so
> > function(HttpContext.Current);
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "Bruce W.1" <no@.direct.email> wrote in message
> > news:401B0E42.3A4D549E@.direct.email...
> > > I need to spin of a thread that periodically checks the Application
> > > state. How can a thread access Application or Session states? Send
it
> > > the httpContext?
> > > > Thanks for your help.
> Right. I didn't consider that context. In that case the main thread would
> need to wait on the worker thread to be finished.
That would do it. However, it would most probably also eliminate the benefit
that the poster was trying to obtain by using a separate thread. Possibly
not.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:O4UfnND6DHA.2656@.TK2MSFTNGP11.phx.gbl...
> Right. I didn't consider that context. In that case the main thread would
> need to wait on the worker thread to be finished.
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Kevin Spencer" <kevin@.takempis.com> wrote in message
> news:OznQqhB6DHA.3308@.TK2MSFTNGP11.phx.gbl...
> > I don't think this will work. If the thread is running separately from
the
> > main Page execution thread, the Page may have already been processed, in
> > which case the Response and Request would not be available.
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:#0T6qXB6DHA.1632@.TK2MSFTNGP12.phx.gbl...
> > > The httpcontext is owned by the main thread so you will need to send
in
> a
> > > reference to the object to the thread. Here is an example:
> > > function(System.Web.HttpContext Stream)
> > > > {
> > > Stream.Response.Write("vlah");
> > > }
> > > call it like so
> > > function(HttpContext.Current);
> > > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Bruce W.1" <no@.direct.email> wrote in message
> > > news:401B0E42.3A4D549E@.direct.email...
> > > > I need to spin of a thread that periodically checks the Application
> > > > state. How can a thread access Application or Session states? Send
> it
> > > > the httpContext?
> > > > > > Thanks for your help.
> >
Thread not working
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
ThxJason,
Actually the Thread will die if the page that created the thread is
destroyed. Use a webservice or Ajax to accomplished that.
Cheers
Al
"Jason Chu" wrote:
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to ge
t
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BU
T
> as soon as I click anything in that second page, the response will be stuc
k
> waiting until the thread processing the upload is done. Now that isn't ve
ry
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that ha
s
> to be done alone and can't be threaded?
> Thx
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to ge
t
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BU
T
> as soon as I click anything in that second page, the response will be stuc
k
> waiting until the thread processing the upload is done. Now that isn't ve
ry
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that ha
s
> to be done alone and can't be threaded?
> Thx
I have heard that IIS queues requests per session. So a second request
within the same session would only be serviced after the first has
completed. (which seems to be the behavior you are seeing)
Hans Kesting
thanx for reply.
As for AJAX, I don't really wanna, cuz all the codes are all done and good
to go in C# (plus there's many components involved...it's just all tied up)
.
As for Webservices...will that make the processing totally separate from the
other processes from the pages (ie button clicks)? I believe both page
actions and webservices are handled by the same asp.net process. if
threading the database process in a page didn't make it separate (since it
hogged up the whole asp.net process), won't putting it on the webservice do
the same thing? (ie asp.net handles the webservice in another of its own
thread, but that thread hogs up the entire asp.net process, so the page
actions have to wait)
I don't want to move all my code to webservices unless I know that it'll
improve it.
"Albert Pascual" wrote:
> Jason,
> Actually the Thread will die if the page that created the thread is
> destroyed. Use a webservice or Ajax to accomplished that.
> Cheers
> Al
> "Jason Chu" wrote:
>
Thanks for replying.
Before I've put the upload processing function into a thread, I did some
tests with multiple users.
If one of that big upload occurs (so it'll take a minute to process), the
other users will still be able to move around the application for a little
bit, but will be stuck needing to wait after several clicks on the page.
For example
So if A initiate the 1 minute process.
B will be able to surf around for a bit, then after several postbacks, the
next postback will be stuck needing to wait for A's process to finish first
before a response comes back.
Kind of feels like asp.net has a buffer for B to move in...and as soon as
that buffer runs out, B will have to wait.
"Hans Kesting" wrote:
> I have heard that IIS queues requests per session. So a second request
> within the same session would only be serviced after the first has
> completed. (which seems to be the behavior you are seeing)
> Hans Kesting
>
>
How do you start the thread?
Should not be a problem if you are using Thread class.
George
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6FA4D
E02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();
simple enough
: )
but if i were to have a problem, then the thread won't even start.
remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.
"George" wrote:
> How do you start the thread?
> Should not be a problem if you are using Thread class.
>
> George
> "Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6
FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to
get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a threa
d.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to anoth
er
> page.
> The thread will start, and browser will get forwarded to the next page,
BUT
> as soon as I click anything in that second page, the response will be st
uck
> waiting until the thread processing the upload is done. Now that isn't
very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that
has
> to be done alone and can't be threaded?
> Thx
I think you have problem somewhere else. Whatever you are doing with threads
looks correct. You might post the whole code for your Page object.
Here are the facts that might help you figure out where problem is.
Session is locked during ASP.NET called. So only one request for one session
can come in. Second request (with same SessionID) will be queued.
The page must run through the whole lifecycle in order for Session object to
be unlocked for next request.
Response.Redirect( url ) or Response.Redirect( url, true ) will terminate pa
ge thus ending it's lifecycle.
Response.Redirect( url, false) will not end the lifecycle you can still be b
locking the session.
----
--
I would replace redirect with Response.Write("AAA") and then see if the IE l
ogo in right top corner is spinning.
If it is that means the page is hanging somewhere.
Hope that helps./
George.
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:FA42C
AAD-EB92-456D-B00B-BC75C1F608CC@.microsoft.com...
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();
simple enough
: )
but if i were to have a problem, then the thread won't even start.
remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.
"George" wrote:
> How do you start the thread?
> Should not be a problem if you are using Thread class.
>
>
> George
>
> "Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6
FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to
get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a threa
d.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to anoth
er
> page.
> The thread will start, and browser will get forwarded to the next page,
BUT
> as soon as I click anything in that second page, the response will be st
uck
> waiting until the thread processing the upload is done. Now that isn't
very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that
has
> to be done alone and can't be threaded?
> Thx
you have the correct approach. nothing in asp.net will cause the behavior
you are seeing, it must be your code forcing serialization. maybe you are
hitting locking problems with the db.
-- bruce (sqlwork.com)
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message
news:6FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
>I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to
> get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page,
> BUT
> as soon as I click anything in that second page, the response will be
> stuck
> waiting until the thread processing the upload is done. Now that isn't
> very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that
> has
> to be done alone and can't be threaded?
> Thx
Thread not working
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
ThxJason,
Actually the Thread will die if the page that created the thread is
destroyed. Use a webservice or Ajax to accomplished that.
Cheers
Al
"Jason Chu" wrote:
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BUT
> as soon as I click anything in that second page, the response will be stuck
> waiting until the thread processing the upload is done. Now that isn't very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that has
> to be done alone and can't be threaded?
> Thx
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BUT
> as soon as I click anything in that second page, the response will be stuck
> waiting until the thread processing the upload is done. Now that isn't very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that has
> to be done alone and can't be threaded?
> Thx
I have heard that IIS queues requests per session. So a second request
within the same session would only be serviced after the first has
completed. (which seems to be the behavior you are seeing)
Hans Kesting
thanx for reply.
As for AJAX, I don't really wanna, cuz all the codes are all done and good
to go in C# (plus there's many components involved...it's just all tied up).
As for Webservices...will that make the processing totally separate from the
other processes from the pages (ie button clicks)? I believe both page
actions and webservices are handled by the same asp.net process. if
threading the database process in a page didn't make it separate (since it
hogged up the whole asp.net process), won't putting it on the webservice do
the same thing? (ie asp.net handles the webservice in another of its own
thread, but that thread hogs up the entire asp.net process, so the page
actions have to wait)
I don't want to move all my code to webservices unless I know that it'll
improve it.
"Albert Pascual" wrote:
> Jason,
> Actually the Thread will die if the page that created the thread is
> destroyed. Use a webservice or Ajax to accomplished that.
> Cheers
> Al
> "Jason Chu" wrote:
> > I have a webpage which uploads a big file onto access db.
> > if the file is say around 30 megs, it'll take around a minute for it to get
> > put into the access db.
> > I didn't want the user to wait for it, so I decided to put it on a thread.
> > The thread works, but not the way it should.
> > One of my page will start the thread, and then forward the user to another
> > page.
> > The thread will start, and browser will get forwarded to the next page, BUT
> > as soon as I click anything in that second page, the response will be stuck
> > waiting until the thread processing the upload is done. Now that isn't very
> > much threaded now is it?...
> > Why is that happening? is putting stuff on the access db a process that has
> > to be done alone and can't be threaded?
> > Thx
Thanks for replying.
Before I've put the upload processing function into a thread, I did some
tests with multiple users.
If one of that big upload occurs (so it'll take a minute to process), the
other users will still be able to move around the application for a little
bit, but will be stuck needing to wait after several clicks on the page.
For example
So if A initiate the 1 minute process.
B will be able to surf around for a bit, then after several postbacks, the
next postback will be stuck needing to wait for A's process to finish first
before a response comes back.
Kind of feels like asp.net has a buffer for B to move in...and as soon as
that buffer runs out, B will have to wait.
"Hans Kesting" wrote:
> > I have a webpage which uploads a big file onto access db.
> > if the file is say around 30 megs, it'll take around a minute for it to get
> > put into the access db.
> > I didn't want the user to wait for it, so I decided to put it on a thread.
> > The thread works, but not the way it should.
> > One of my page will start the thread, and then forward the user to another
> > page.
> > The thread will start, and browser will get forwarded to the next page, BUT
> > as soon as I click anything in that second page, the response will be stuck
> > waiting until the thread processing the upload is done. Now that isn't very
> > much threaded now is it?...
> > Why is that happening? is putting stuff on the access db a process that has
> > to be done alone and can't be threaded?
> > Thx
> I have heard that IIS queues requests per session. So a second request
> within the same session would only be serviced after the first has
> completed. (which seems to be the behavior you are seeing)
> Hans Kesting
>
How do you start the thread?
Should not be a problem if you are using Thread class.
George
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
I have a webpage which uploads a big file onto access db.
if the file is say around 30 megs, it'll take around a minute for it to get
put into the access db.
I didn't want the user to wait for it, so I decided to put it on a thread.
The thread works, but not the way it should.
One of my page will start the thread, and then forward the user to another
page.
The thread will start, and browser will get forwarded to the next page, BUT
as soon as I click anything in that second page, the response will be stuck
waiting until the thread processing the upload is done. Now that isn't very
much threaded now is it?...
Why is that happening? is putting stuff on the access db a process that has
to be done alone and can't be threaded?
Thx
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();
simple enough
: )
but if i were to have a problem, then the thread won't even start.
remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.
"George" wrote:
> How do you start the thread?
> Should not be a problem if you are using Thread class.
>
> George
> "Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BUT
> as soon as I click anything in that second page, the response will be stuck
> waiting until the thread processing the upload is done. Now that isn't very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that has
> to be done alone and can't be threaded?
> Thx
I think you have problem somewhere else. Whatever you are doing with threads looks correct. You might post the whole code for your Page object.
Here are the facts that might help you figure out where problem is.
Session is locked during ASP.NET called. So only one request for one session can come in. Second request (with same SessionID) will be queued.
The page must run through the whole lifecycle in order for Session object to be unlocked for next request.
Response.Redirect( url ) or Response.Redirect( url, true ) will terminate page thus ending it's lifecycle.
Response.Redirect( url, false) will not end the lifecycle you can still be blocking the session.
---------------------------
I would replace redirect with Response.Write("AAA") and then see if the IE logo in right top corner is spinning.
If it is that means the page is hanging somewhere.
Hope that helps./
George.
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:FA42CAAD-EB92-456D-B00B-BC75C1F608CC@.microsoft.com...
ProcessorContainer pc = new ProcessorContainer(parameters);
Thread thread = new Thread(new ThreadStart(pc.ProcessUpload));
thread.Start();
simple enough
: )
but if i were to have a problem, then the thread won't even start.
remind you, that the big processing part is shoving the file into the access
db, so the one line causing the wait is the ExecuteNonQuery() of the
OleDbCommand.
"George" wrote:
> How do you start the thread?
> Should not be a problem if you are using Thread class.
>
>
> George
>
> "Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message news:6FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
> I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page, BUT
> as soon as I click anything in that second page, the response will be stuck
> waiting until the thread processing the upload is done. Now that isn't very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that has
> to be done alone and can't be threaded?
> Thx
you have the correct approach. nothing in asp.net will cause the behavior
you are seeing, it must be your code forcing serialization. maybe you are
hitting locking problems with the db.
-- bruce (sqlwork.com)
"Jason Chu" <JasonChu@.discussions.microsoft.com> wrote in message
news:6FA4DE02-436E-4C10-99A2-B0AE0F758DB5@.microsoft.com...
>I have a webpage which uploads a big file onto access db.
> if the file is say around 30 megs, it'll take around a minute for it to
> get
> put into the access db.
> I didn't want the user to wait for it, so I decided to put it on a thread.
> The thread works, but not the way it should.
> One of my page will start the thread, and then forward the user to another
> page.
> The thread will start, and browser will get forwarded to the next page,
> BUT
> as soon as I click anything in that second page, the response will be
> stuck
> waiting until the thread processing the upload is done. Now that isn't
> very
> much threaded now is it?...
> Why is that happening? is putting stuff on the access db a process that
> has
> to be done alone and can't be threaded?
> Thx
Tuesday, March 13, 2012
Thread safe singleton to access the cache?
Currently, I have an object that stands between my business logic and
database logic called CacheLogic (cute, no?). Global.asax.cs creates it in
Application_Start, initializes it and places it in the cache. During
initialization, CacheLogic retrieves data from the DB logic layer and caches
it with removal callbacks set. Whenever an object in the business logic
layer needs data, it grabs the CacheLogic object from the cache (that's a
violation of the layer right there, I know), and requests the needed data
from it. CacheLogic retrieves the data from the cache and returns it. If the
data is not in the cache, it retrieves the data from the database logic
layer, caches it (with removal callbacks), and then returns the data.
I'm concerned about what happens when two clients are requesting the same
data at the same time when that data is not in the cache. Right now, as I
understand it, CacheLogic will hit the database and cache the data twice.
I'm not sure what side effects that might have, so I'm trying to figure out
ways to avoid this situation completely without killing performance (i.e.,
lock(HttpContext.Current.Cache)).
To make CacheLogic more thread safe, I can lock on a sync object in the
class when I write to the cache or use Mutex. But what use is that unless I
also lock when I read from the cache? And isn't that just as bad as locking
the cache object itself?
The other issue I have is that CacheLogic stores objects in the cache with
removal callbacks pointing to methods in the CacheLogic object. If I create
CacheLogic objects willy-nilly, I could end up with multiple objects in
memory, referenced only by the callback in some cache object. Sounds too
close to a memory leak for me. Currently, by storing a single CacheLogic
object in the cache itself, I have one single object that handles caching and
callbacks for all client connections. I'm not happy that in order to get the
CacheLogic object, other objects have to violate the layers and access the
cache directly.
Do I even need to worry about keeping a single CacheLogic object? Is
converting CacheLogic into a singleton (is there an ISingleton interface?) a
good solution to this problem? And, if I do, once I use the CacheLogic
singleton in Application_Start (assuming I code it properly), will it be
truly available to all clients who call CacheLogic.GetInstance()?you are correct need to lock the cache on read and writes. how well you
design the locking will control how mush a bottleneck it will. if the cache
is readonly, (and the cache objects are thread safe), then you only need to
synchronize access to the cache, not the objects themselves.
not sure what your removal callbacks are used for. typically caches allow
removal of any object at anytime, to allow cache pruning.
switching to a Singleton is just a design pattern (static method to access
object), it does not change your locking issues, you still need to handle
these.
-- bruce (sqlwork.com)
"William Sullivan" <WilliamSullivan@.discussions.microsoft.com> wrote in
message news:D0527EBA-8DAD-464E-92AA-558F32F4AE44@.microsoft.com...
> I'm trying to nail down some issues with the cache in my application.
> Currently, I have an object that stands between my business logic and
> database logic called CacheLogic (cute, no?). Global.asax.cs creates it
> in
> Application_Start, initializes it and places it in the cache. During
> initialization, CacheLogic retrieves data from the DB logic layer and
> caches
> it with removal callbacks set. Whenever an object in the business logic
> layer needs data, it grabs the CacheLogic object from the cache (that's a
> violation of the layer right there, I know), and requests the needed data
> from it. CacheLogic retrieves the data from the cache and returns it. If
> the
> data is not in the cache, it retrieves the data from the database logic
> layer, caches it (with removal callbacks), and then returns the data.
> I'm concerned about what happens when two clients are requesting the same
> data at the same time when that data is not in the cache. Right now, as I
> understand it, CacheLogic will hit the database and cache the data twice.
> I'm not sure what side effects that might have, so I'm trying to figure
> out
> ways to avoid this situation completely without killing performance (i.e.,
> lock(HttpContext.Current.Cache)).
> To make CacheLogic more thread safe, I can lock on a sync object in the
> class when I write to the cache or use Mutex. But what use is that unless
> I
> also lock when I read from the cache? And isn't that just as bad as
> locking
> the cache object itself?
> The other issue I have is that CacheLogic stores objects in the cache with
> removal callbacks pointing to methods in the CacheLogic object. If I
> create
> CacheLogic objects willy-nilly, I could end up with multiple objects in
> memory, referenced only by the callback in some cache object. Sounds too
> close to a memory leak for me. Currently, by storing a single CacheLogic
> object in the cache itself, I have one single object that handles caching
> and
> callbacks for all client connections. I'm not happy that in order to get
> the
> CacheLogic object, other objects have to violate the layers and access the
> cache directly.
> Do I even need to worry about keeping a single CacheLogic object? Is
> converting CacheLogic into a singleton (is there an ISingleton interface?)
> a
> good solution to this problem? And, if I do, once I use the CacheLogic
> singleton in Application_Start (assuming I code it properly), will it be
> truly available to all clients who call CacheLogic.GetInstance()?
Thread safe singleton to access the cache?
Currently, I have an object that stands between my business logic and
database logic called CacheLogic (cute, no?). Global.asax.cs creates it in
Application_Start, initializes it and places it in the cache. During
initialization, CacheLogic retrieves data from the DB logic layer and caches
it with removal callbacks set. Whenever an object in the business logic
layer needs data, it grabs the CacheLogic object from the cache (that's a
violation of the layer right there, I know), and requests the needed data
from it. CacheLogic retrieves the data from the cache and returns it. If th
e
data is not in the cache, it retrieves the data from the database logic
layer, caches it (with removal callbacks), and then returns the data.
I'm concerned about what happens when two clients are requesting the same
data at the same time when that data is not in the cache. Right now, as I
understand it, CacheLogic will hit the database and cache the data twice.
I'm not sure what side effects that might have, so I'm trying to figure out
ways to avoid this situation completely without killing performance (i.e.,
lock(HttpContext.Current.Cache)).
To make CacheLogic more thread safe, I can lock on a sync object in the
class when I write to the cache or use Mutex. But what use is that unless I
also lock when I read from the cache? And isn't that just as bad as lockin
g
the cache object itself?
The other issue I have is that CacheLogic stores objects in the cache with
removal callbacks pointing to methods in the CacheLogic object. If I create
CacheLogic objects willy-nilly, I could end up with multiple objects in
memory, referenced only by the callback in some cache object. Sounds too
close to a memory leak for me. Currently, by storing a single CacheLogic
object in the cache itself, I have one single object that handles caching an
d
callbacks for all client connections. I'm not happy that in order to get th
e
CacheLogic object, other objects have to violate the layers and access the
cache directly.
Do I even need to worry about keeping a single CacheLogic object? Is
converting CacheLogic into a singleton (is there an ISingleton interface?) a
good solution to this problem? And, if I do, once I use the CacheLogic
singleton in Application_Start (assuming I code it properly), will it be
truly available to all clients who call CacheLogic.GetInstance()?you are correct need to lock the cache on read and writes. how well you
design the locking will control how mush a bottleneck it will. if the cache
is readonly, (and the cache objects are thread safe), then you only need to
synchronize access to the cache, not the objects themselves.
not sure what your removal callbacks are used for. typically caches allow
removal of any object at anytime, to allow cache pruning.
switching to a Singleton is just a design pattern (static method to access
object), it does not change your locking issues, you still need to handle
these.
-- bruce (sqlwork.com)
"William Sullivan" <WilliamSullivan@.discussions.microsoft.com> wrote in
message news:D0527EBA-8DAD-464E-92AA-558F32F4AE44@.microsoft.com...
> I'm trying to nail down some issues with the cache in my application.
> Currently, I have an object that stands between my business logic and
> database logic called CacheLogic (cute, no?). Global.asax.cs creates it
> in
> Application_Start, initializes it and places it in the cache. During
> initialization, CacheLogic retrieves data from the DB logic layer and
> caches
> it with removal callbacks set. Whenever an object in the business logic
> layer needs data, it grabs the CacheLogic object from the cache (that's a
> violation of the layer right there, I know), and requests the needed data
> from it. CacheLogic retrieves the data from the cache and returns it. If
> the
> data is not in the cache, it retrieves the data from the database logic
> layer, caches it (with removal callbacks), and then returns the data.
> I'm concerned about what happens when two clients are requesting the same
> data at the same time when that data is not in the cache. Right now, as I
> understand it, CacheLogic will hit the database and cache the data twice.
> I'm not sure what side effects that might have, so I'm trying to figure
> out
> ways to avoid this situation completely without killing performance (i.e.,
> lock(HttpContext.Current.Cache)).
> To make CacheLogic more thread safe, I can lock on a sync object in the
> class when I write to the cache or use Mutex. But what use is that unless
> I
> also lock when I read from the cache? And isn't that just as bad as
> locking
> the cache object itself?
> The other issue I have is that CacheLogic stores objects in the cache with
> removal callbacks pointing to methods in the CacheLogic object. If I
> create
> CacheLogic objects willy-nilly, I could end up with multiple objects in
> memory, referenced only by the callback in some cache object. Sounds too
> close to a memory leak for me. Currently, by storing a single CacheLogic
> object in the cache itself, I have one single object that handles caching
> and
> callbacks for all client connections. I'm not happy that in order to get
> the
> CacheLogic object, other objects have to violate the layers and access the
> cache directly.
> Do I even need to worry about keeping a single CacheLogic object? Is
> converting CacheLogic into a singleton (is there an ISingleton interface?)
> a
> good solution to this problem? And, if I do, once I use the CacheLogic
> singleton in Application_Start (assuming I code it properly), will it be
> truly available to all clients who call CacheLogic.GetInstance()?
>
Thread was being aborted errors
I have an asp.net web app that is intermittently throwing "Thread was being
aborted." errors in my data access component. This seems to occur when the
app is under a heavier than normal load. I don't get any of these errors for
days, then I get a bunch all at once.
I would have thought if the database call was timing out I would get a
timeout
error.
The server is Win 2003 (under VMware), and hosts multiple asp and asp.net
web applications.
This is a sample of the exception details I'm getting:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior behavior)
at
System.Data.SqlClient.SqlCommand.System.Data.IDbCo mmand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at NCSUtilities.DataAccess.ExecuteDataset(SqlConnecti on connection,
CommandType commandType, String commandText, SqlParameter[] commandParameters)
at NCSUtilities.DataAccess.ExecuteDataset(String connectionString,
CommandType commandType, String commandText, SqlParameter[] commandParameters)
I got a suggestion to look at the "DefaultAppPool" properties on the web
server, but I'm not sure what settings to modify.
Any ideas on how I could identify the cause or how I could resolve this
would be greatly appreciated.
Thanks,
Keith FIn most circumstances that I have seen, this issue occurs when the
application pool is being reset. One easy way to isolate the problem is to
match the times of the thread error with the application pool reset log in
the windows event viewer. The fix is to increase the recycle parameters on
the applicaiton pool in question.
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Keith F." <KeithF@.discussions.microsoft.com> wrote in message
news:D42B570D-11E4-485A-8CA9-B55D3D31A389@.microsoft.com...
> Hi,
> I have an asp.net web app that is intermittently throwing "Thread was
> being
> aborted." errors in my data access component. This seems to occur when the
> app is under a heavier than normal load. I don't get any of these errors
> for
> days, then I get a bunch all at once.
> I would have thought if the database call was timing out I would get a
> timeout
> error.
> The server is Win 2003 (under VMware), and hosts multiple asp and asp.net
> web applications.
> This is a sample of the exception details I'm getting:
> System.Threading.ThreadAbortException: Thread was being aborted.
> at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
> at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
> behavior)
> at
> System.Data.SqlClient.SqlCommand.System.Data.IDbCo mmand.ExecuteReader(CommandBehavior
> behavior)
> at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
> at NCSUtilities.DataAccess.ExecuteDataset(SqlConnecti on connection,
> CommandType commandType, String commandText, SqlParameter[]
> commandParameters)
> at NCSUtilities.DataAccess.ExecuteDataset(String connectionString,
> CommandType commandType, String commandText, SqlParameter[]
> commandParameters)
> I got a suggestion to look at the "DefaultAppPool" properties on the web
> server, but I'm not sure what settings to modify.
> Any ideas on how I could identify the cause or how I could resolve this
> would be greatly appreciated.
> Thanks,
> Keith F
Thread was being aborted errors
I have an asp.net web app that is intermittently throwing "Thread was being
aborted." errors in my data access component. This seems to occur when the
app is under a heavier than normal load. I don't get any of these errors for
days, then I get a bunch all at once.
I would have thought if the database call was timing out I would get a
timeout
error.
The server is Win 2003 (under VMware), and hosts multiple asp and asp.net
web applications.
This is a sample of the exception details I'm getting:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(Comman
dBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at NCSUtilities.DataAccess.ExecuteDataset(SqlConnection connection,
CommandType commandType, String commandText, SqlParameter[] commandParameter
s)
at NCSUtilities.DataAccess.ExecuteDataset(String connectionString,
CommandType commandType, String commandText, SqlParameter[] commandParameter
s)
I got a suggestion to look at the "DefaultAppPool" properties on the web
server, but I'm not sure what settings to modify.
Any ideas on how I could identify the cause or how I could resolve this
would be greatly appreciated.
Thanks,
Keith FIn most circumstances that I have seen, this issue occurs when the
application pool is being reset. One easy way to isolate the problem is to
match the times of the thread error with the application pool reset log in
the windows event viewer. The fix is to increase the recycle parameters on
the applicaiton pool in question.
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Keith F." <KeithF@.discussions.microsoft.com> wrote in message
news:D42B570D-11E4-485A-8CA9-B55D3D31A389@.microsoft.com...
> Hi,
> I have an asp.net web app that is intermittently throwing "Thread was
> being
> aborted." errors in my data access component. This seems to occur when the
> app is under a heavier than normal load. I don't get any of these errors
> for
> days, then I get a bunch all at once.
> I would have thought if the database call was timing out I would get a
> timeout
> error.
> The server is Win 2003 (under VMware), and hosts multiple asp and asp.net
> web applications.
> This is a sample of the exception details I'm getting:
> System.Threading.ThreadAbortException: Thread was being aborted.
> at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
> at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
> behavior)
> at
> System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(Comm
andBehavior
> behavior)
> at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
> at NCSUtilities.DataAccess.ExecuteDataset(SqlConnection connection,
> CommandType commandType, String commandText, SqlParameter[]
> commandParameters)
> at NCSUtilities.DataAccess.ExecuteDataset(String connectionString,
> CommandType commandType, String commandText, SqlParameter[]
> commandParameters)
> I got a suggestion to look at the "DefaultAppPool" properties on the web
> server, but I'm not sure what settings to modify.
> Any ideas on how I could identify the cause or how I could resolve this
> would be greatly appreciated.
> Thanks,
> Keith F
>