Connecting Tech Pros Worldwide Forums | Help | Site Map

How to allow only one user to access a web page at one time?

Ben
Guest
 
Posts: n/a
#1: Jun 7 '06
Hi,

In ASP.NET website, I have a web page is used to dump raw data into
database (SQL Server). The database data will corrupt if two users
dump raw data concurrently.
How to allow only one user to access a web page at one time?

Thanks,
Ben


Demetri
Guest
 
Posts: n/a
#2: Jun 7 '06

re: How to allow only one user to access a web page at one time?


I think you are looking at this all wrong. Its not the page that is the
concern its the data input. Therefore, I would implement some sort of
asynchronous input of data ( queue if you will). This way users can come and
dump data all day long at the same time but your system will only do one at a
time.

--
-Demetri


"Ben" wrote:
[color=blue]
> Hi,
>
> In ASP.NET website, I have a web page is used to dump raw data into
> database (SQL Server). The database data will corrupt if two users
> dump raw data concurrently.
> How to allow only one user to access a web page at one time?
>
> Thanks,
> Ben
>
>[/color]
sdbillsfan@gmail.com
Guest
 
Posts: n/a
#3: Jun 7 '06

re: How to allow only one user to access a web page at one time?


That doesn't make any sense though, SQL Server (as with all RDBMS') is
perfectly capable of inherently handling concurrent DML without
corruption. I have the feeling the problem is somewhere else (DAL
perhaps?).

Demetri wrote:[color=blue]
> I think you are looking at this all wrong. Its not the page that is the
> concern its the data input. Therefore, I would implement some sort of
> asynchronous input of data ( queue if you will). This way users can come and
> dump data all day long at the same time but your system will only do one at a
> time.
>
> --
> -Demetri
>
>
> "Ben" wrote:
>[color=green]
> > Hi,
> >
> > In ASP.NET website, I have a web page is used to dump raw data into
> > database (SQL Server). The database data will corrupt if two users
> > dump raw data concurrently.
> > How to allow only one user to access a web page at one time?
> >
> > Thanks,
> > Ben
> >
> >[/color][/color]

Peter Bromberg [C# MVP]
Guest
 
Posts: n/a
#4: Jun 7 '06

re: How to allow only one user to access a web page at one time?


I agree with Dimitry, but essentially all you need to do is set an
Application variable
Application["InUse"]=true while the dump operation is going and set it back
to
Application["InUse"]=false when it is done.
For all requests to the page, in the Page_Load handler,
if( Convert.ToBoolean(Application["InUse"])
Response.End();

That should pretty much cover it very simply.

Peter


--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Ben" wrote:
[color=blue]
> Hi,
>
> In ASP.NET website, I have a web page is used to dump raw data into
> database (SQL Server). The database data will corrupt if two users
> dump raw data concurrently.
> How to allow only one user to access a web page at one time?
>
> Thanks,
> Ben
>
>[/color]
John Timney \(MVP\)
Guest
 
Posts: n/a
#5: Jun 7 '06

re: How to allow only one user to access a web page at one time?


An easy solution would be to limit access to only one named user in
web.configs location tag. But to limit it to one random user - instead of
limiting access to a page, check if the SQL statement is running by setting
a simple flag in the DB and checkings its value before running the data
dump. If it is reject the request.
--
Regards

John Timney (MVP)



"Ben" <wubin_98@yahoo.com> wrote in message
news:1149709103.484024.82410@i39g2000cwa.googlegro ups.com...[color=blue]
> Hi,
>
> In ASP.NET website, I have a web page is used to dump raw data into
> database (SQL Server). The database data will corrupt if two users
> dump raw data concurrently.
> How to allow only one user to access a web page at one time?
>
> Thanks,
> Ben
>[/color]


Ben
Guest
 
Posts: n/a
#6: Jun 7 '06

re: How to allow only one user to access a web page at one time?


Thanks for all the replies.

The raw data is in excel format. Actually, it is not just dumping.
There are a lot of deleting, updating, inserting and verifications on
database records. So it is not a single Query or stored procedure. Each
record is processed in ASP page by loop.

Ben

sdbillsfan@gmail.com wrote:[color=blue]
> That doesn't make any sense though, SQL Server (as with all RDBMS') is
> perfectly capable of inherently handling concurrent DML without
> corruption. I have the feeling the problem is somewhere else (DAL
> perhaps?).
>
> Demetri wrote:[color=green]
> > I think you are looking at this all wrong. Its not the page that is the
> > concern its the data input. Therefore, I would implement some sort of
> > asynchronous input of data ( queue if you will). This way users can come and
> > dump data all day long at the same time but your system will only do one at a
> > time.
> >
> > --
> > -Demetri
> >
> >
> > "Ben" wrote:
> >[color=darkred]
> > > Hi,
> > >
> > > In ASP.NET website, I have a web page is used to dump raw data into
> > > database (SQL Server). The database data will corrupt if two users
> > > dump raw data concurrently.
> > > How to allow only one user to access a web page at one time?
> > >
> > > Thanks,
> > > Ben
> > >
> > >[/color][/color][/color]

Bob Barrows [MVP]
Guest
 
Posts: n/a
#7: Jun 7 '06

re: How to allow only one user to access a web page at one time?


So use a transaction ...
Ben wrote:[color=blue]
> Thanks for all the replies.
>
> The raw data is in excel format. Actually, it is not just dumping.
> There are a lot of deleting, updating, inserting and verifications on
> database records. So it is not a single Query or stored procedure.
> Each record is processed in ASP page by loop.
>
> Ben
>
> sdbillsfan@gmail.com wrote:[color=green]
>> That doesn't make any sense though, SQL Server (as with all RDBMS')
>> is perfectly capable of inherently handling concurrent DML without
>> corruption. I have the feeling the problem is somewhere else (DAL
>> perhaps?).
>>
>> Demetri wrote:[color=darkred]
>>> I think you are looking at this all wrong. Its not the page that is
>>> the concern its the data input. Therefore, I would implement some
>>> sort of asynchronous input of data ( queue if you will). This way
>>> users can come and dump data all day long at the same time but your
>>> system will only do one at a time.
>>>
>>> --
>>> -Demetri
>>>
>>>
>>> "Ben" wrote:
>>>
>>>> Hi,
>>>>
>>>> In ASP.NET website, I have a web page is used to dump raw data into
>>>> database (SQL Server). The database data will corrupt if two users
>>>> dump raw data concurrently.
>>>> How to allow only one user to access a web page at one time?
>>>>
>>>> Thanks,
>>>> Ben[/color][/color][/color]

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Demetri
Guest
 
Posts: n/a
#8: Jun 7 '06

re: How to allow only one user to access a web page at one time?


I wouldn't want to reject the request and have the user re-submit a bunch of
times in a row until it goes through. That is not a good user experience.
Again, a queue of some sort to manage the input one at a time in an
asynchronous fashion is more sound in my eyes.

--
-Demetri


"John Timney (MVP)" wrote:
[color=blue]
> An easy solution would be to limit access to only one named user in
> web.configs location tag. But to limit it to one random user - instead of
> limiting access to a page, check if the SQL statement is running by setting
> a simple flag in the DB and checkings its value before running the data
> dump. If it is reject the request.
> --
> Regards
>
> John Timney (MVP)
>
>
>
> "Ben" <wubin_98@yahoo.com> wrote in message
> news:1149709103.484024.82410@i39g2000cwa.googlegro ups.com...[color=green]
> > Hi,
> >
> > In ASP.NET website, I have a web page is used to dump raw data into
> > database (SQL Server). The database data will corrupt if two users
> > dump raw data concurrently.
> > How to allow only one user to access a web page at one time?
> >
> > Thanks,
> > Ben
> >[/color]
>
>
>[/color]
Peter Bromberg [C# MVP]
Guest
 
Posts: n/a
#9: Jun 7 '06

re: How to allow only one user to access a web page at one time?


Agreed,
but in this case our OP is probably not at that level of experience yet. To
be really efficient, you could offload the request into an MSMQ queue, and
have a separate process retrieve the items from the queue and process them
one - by - one.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Demetri" wrote:
[color=blue]
> I wouldn't want to reject the request and have the user re-submit a bunch of
> times in a row until it goes through. That is not a good user experience.
> Again, a queue of some sort to manage the input one at a time in an
> asynchronous fashion is more sound in my eyes.
>
> --
> -Demetri
>
>
> "John Timney (MVP)" wrote:
>[color=green]
> > An easy solution would be to limit access to only one named user in
> > web.configs location tag. But to limit it to one random user - instead of
> > limiting access to a page, check if the SQL statement is running by setting
> > a simple flag in the DB and checkings its value before running the data
> > dump. If it is reject the request.
> > --
> > Regards
> >
> > John Timney (MVP)
> >
> >
> >
> > "Ben" <wubin_98@yahoo.com> wrote in message
> > news:1149709103.484024.82410@i39g2000cwa.googlegro ups.com...[color=darkred]
> > > Hi,
> > >
> > > In ASP.NET website, I have a web page is used to dump raw data into
> > > database (SQL Server). The database data will corrupt if two users
> > > dump raw data concurrently.
> > > How to allow only one user to access a web page at one time?
> > >
> > > Thanks,
> > > Ben
> > >[/color]
> >
> >
> >[/color][/color]
John Timney \(MVP\)
Guest
 
Posts: n/a
#10: Jun 8 '06

re: How to allow only one user to access a web page at one time?


I agree with you Peter. Hence my somewhat simple suggestions.

Regards

John Timney (MVP)


"Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.com> wrote in message
news:35A48E89-0E1A-4F9A-8BD1-6A6BDF6BF5BD@microsoft.com...[color=blue]
> Agreed,
> but in this case our OP is probably not at that level of experience yet.
> To
> be really efficient, you could offload the request into an MSMQ queue, and
> have a separate process retrieve the items from the queue and process them
> one - by - one.
> Peter
>
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Demetri" wrote:
>[color=green]
>> I wouldn't want to reject the request and have the user re-submit a bunch
>> of
>> times in a row until it goes through. That is not a good user experience.
>> Again, a queue of some sort to manage the input one at a time in an
>> asynchronous fashion is more sound in my eyes.
>>
>> --
>> -Demetri
>>
>>
>> "John Timney (MVP)" wrote:
>>[color=darkred]
>> > An easy solution would be to limit access to only one named user in
>> > web.configs location tag. But to limit it to one random user - instead
>> > of
>> > limiting access to a page, check if the SQL statement is running by
>> > setting
>> > a simple flag in the DB and checkings its value before running the data
>> > dump. If it is reject the request.
>> > --
>> > Regards
>> >
>> > John Timney (MVP)
>> >
>> >
>> >
>> > "Ben" <wubin_98@yahoo.com> wrote in message
>> > news:1149709103.484024.82410@i39g2000cwa.googlegro ups.com...
>> > > Hi,
>> > >
>> > > In ASP.NET website, I have a web page is used to dump raw data into
>> > > database (SQL Server). The database data will corrupt if two users
>> > > dump raw data concurrently.
>> > > How to allow only one user to access a web page at one time?
>> > >
>> > > Thanks,
>> > > Ben
>> > >
>> >
>> >
>> >[/color][/color][/color]


Closed Thread