Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to allow only one user to access a web page at one time?

Reply
Thread Tools

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

 
 
Ben
Guest
Posts: n/a
 
      06-07-2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVtZXRyaQ==?=
Guest
Posts: n/a
 
      06-07-2006
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
>
>

 
Reply With Quote
 
 
 
 
sdbillsfan@gmail.com
Guest
Posts: n/a
 
      06-07-2006
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:
> 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
> >
> >


 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      06-07-2006
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:

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

 
Reply With Quote
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      06-07-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
Ben
Guest
Posts: n/a
 
      06-07-2006
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

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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:
> > 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
> > >
> > >


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-07-2006
So use a transaction ...
Ben wrote:
> 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
>
> (E-Mail Removed) wrote:
>> 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:
>>> 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


--
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.


 
Reply With Quote
 
=?Utf-8?B?RGVtZXRyaQ==?=
Guest
Posts: n/a
 
      06-07-2006
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:

> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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
> >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      06-07-2006
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:

> 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:
>
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed) 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
> > >

> >
> >
> >

 
Reply With Quote
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      06-08-2006
I agree with you Peter. Hence my somewhat simple suggestions.

Regards

John Timney (MVP)


"Peter Bromberg [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:
>
>> 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:
>>
>> > 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" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed) 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
>> > >
>> >
>> >
>> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to allow only ONE user on an ASPX web site? (C#) S_K ASP .Net 18 10-19-2007 12:05 PM
using web config to allow access to domain users only Carlos ASP .Net 4 09-22-2005 01:56 PM
How to restrict direct access to JSP files, only allow access via servlet? Anan Java 8 12-08-2004 11:16 PM
Location element in the Web.config file. Allow System Admin whole directory, allow others specific page Ryan Taylor ASP .Net Security 1 09-09-2004 06:52 PM



Advertisments