Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Saturday, March 31, 2012

Separate by comma

Hi,

I have a datalist on my page to select data from a table

I want to access it with code to insert its values to another table. Te datalist will return more than one row, so i'd like the values seperated by commas when they are inserted to the new table (all in one row).

I have looked around and it seems that I need to do something to the select statement of the other control first - I have got:

SELECT [Usersname]= COALESCE (Usersname + ' , ' , ' ')
FROM [Transactions] WHERE ([Itemid] = @dotnet.itags.org.Itemid)

Does that look right?

And when I have selected these values, how do I insert them in the same format (separated by commas) ?:

DataView dv = SqlDataSource2.Select(DataSourceSelectArguments.Empty) as DataView;
string receivername = dv[0]["receivername"].ToString();
command.Parameters.AddWithValue("@dotnet.itags.org.recievername", receivername);

Would that still work?

Thanks,

Jon

pls help!!


You can pass the value (comma separated value) to a stored procedure as a parameter.

Within the procedure you can insert the data into the table. Before inserting the data into the table we have to split it by comma and then we have to place in a temporary table.

Now we have to extract the data from temp table to actual table.

There is a function called "split" is available to split the data and it will return the data as a table. You can use the same function to insert into your table.

You can get this function at of this URL:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

http://vadivel.blogspot.com/2006/05/split-function-in-sql-server-method-1.html

Hope this helps you.

Separate data by comma

Hi,

I have a datalist on my page and I want to access it with code to insert its values, seperated by commas.

I have looked around and it seems that I need to do something to the select statement of the other control first - I have got:

SELECT [Usersname]= COALESCE (Usersname + ' , ' , ' ')
FROM [Transactions] WHERE ([Itemid] = @dotnet.itags.org.Itemid)

Does that look right?

And when I have selected these values, how do I insert them in the same format (separated by commas) ?:

DataView dv = SqlDataSource2.Select(DataSourceSelectArguments.Empty) as DataView;
string receivername = dv[0]["receivername"].ToString();
command.Parameters.AddWithValue("@dotnet.itags.org.recievername", receivername);

Would that still work?

Thanks,

Jon

pls help!


If I m not wrong, I understand from your question that you need to enter multiple rows in database.

You can refer

http://zirmandli.wordpress.com/2007/09/22/data-access-application-block-gets-batch-update-functionality-in-enterprise-library-30/

I hope this will help u....


Hi,

No, I didnt explain well enough. I will repost.

Thanks anyway

Jon

Thursday, March 29, 2012

separating layers

hey all

i have found lots of tutorials on seperating the data access layer but couldnt find any on seperating the presentation layer...what i require is something like this.

i have a page testPage.aspx
<asp:datagrid ...>formatting of data here</asp:datagrid>
<asp:label></asp:label>
and more...

and in code behind i have:
------------------
string strsql = "select * from tbl_name";
dataset ds = test.dal.executeds(strsql);
datagrid.datasource = ds
datagrid.databind()

some more binding and formatting
------------------

presentation layer
application layer
business logic layer - i got this sorted as well
data access layer - using microsoft dal

how do i elimate 'string strsql' in codebehind so no sql stuff is done in codebehind...and also i want to render testPage to a format thats specified in a xml file, so if xml file changes rendering changes without having to recompile the project.

any suggestions would be very much appriciated

thanksHi,

say you have these 3 layers named : webui, br, dal.

So in your code behind you would call the business rules:

dataset ds = br.getmydata();
datagrid.datasource = ds;
datagrid.databind();

In your business you typically do some checking:

so in your method getmydata() you can write something like this:

return new dal.getmydata();

and in your dal you can finally write something like this in your dal's method getmydata:

string strsql = "select * from tbl_name";
... do the rest of your data retrieval here and return your dataset.

For your other question: I believe Microsoft's using something like mspx for this.

Grz, Kris.

Separating presentation and data access tier. Best Practices for writing simple/intermedia

Hi,

I am writing a simple code, where I am a accessing database table, and based on the content of the table I dynamically generate a webform. In the webform I have a few buttons which when clicked do some dataaccess.

I have a class that performs all the dataacess, another class that I use to place the controls on the webform.
I am not sure if the code design is appropriate. The presentation and biz logic layer are not completely separated. I would like to know some best practice coding tips from the experianced ppl here. Or if anyone can send a pseudocode of his/her coding methods.

I would like to know when writing simple modules, which typically involves some dataaccess, data manipulation and then data presentation, which layer should go into the events like Page_load and CmdButton_click.

In the code below, I am not quite comfortable with SQL statement generation in the Page_Load event

My code structure looks like


Page_load()
{

string SQL="some sql stmt"
DataSet dsdata=new DataSet()
dsdata=dataaccessclass.getdata(SQL)

foreach(datarow dr in dsdata)
{

if(some condition)
//create control A
//set control properties based on dr
//call addcontrolclass.placecontrolAfunction
else
{

}

}

Cmd_Button_click()
{

//check which button is clicked
//make a SQL statment as string
//call dataaccessclass.performoperation(SQL)

}

Hey there,

I find when I'm writing, the best way to keep it all separate is to write a bindcontrols() procedure that makes calls to the logic classes/methods, this way populating your controls is done by calls the furthest away you can get from your presentation layer.

Hope it helps, it is saturday night where I am and I have had a few brewskies!

Cheers

Steve
I would seriously contemplating looking at the MS Data Access Applcation Blocks. I Class Library that takes care of your DAL quite elegantly (it's free, and all the source code is included, and it's really simple to use):

Data Access Applcation Blocks

Monday, March 26, 2012

Sequence problem in database

Hi,
I create a database in access. For example, There is a table named 'table1'.
There are 3 field in this table,'projectId','taskId','description';
The data type of taskId is sequence.
When i add any data in this table, i want the value of taskId to be increased according to projectID(also project ID is sequence) Is it possible?If so, how?

Thanks!For example:

projectID TaskID
1 1
1 2
2 1
2 2
2 3
1 3
1 4
3 1
2 4

blah..blah..

Thanks!

serial port access from asp.net

I need to access the serial ports on my webserver from an asp.net page. I
have no problem accessing the serial ports from a windows form application,
but the code doesn't work in asp.net. I have been told it is not possible t
o
access the serial ports from asp.net.
The application is used to control custom hardware. The hardware is
connected to a PC through serial ports. Our customer wants to control the
hardware from a remote location so our idea was to have IIS running on the P
C
and the recorder controlled through a web page.I would consider a solution with a windows service controlling the device
and an ASP.NET application talking to the windows service via a common
persistent data storage, such as a file.
Eliyahu
"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:4BE38333-D04D-4F22-8D88-848840906461@.microsoft.com...
> I need to access the serial ports on my webserver from an asp.net page. I
> have no problem accessing the serial ports from a windows form
application,
> but the code doesn't work in asp.net. I have been told it is not possible
to
> access the serial ports from asp.net.
> The application is used to control custom hardware. The hardware is
> connected to a PC through serial ports. Our customer wants to control the
> hardware from a remote location so our idea was to have IIS running on the
PC
> and the recorder controlled through a web page.
There are no managed APIs to connect to the serial port in v1.x. There are
in v2.0 though. If you need a solution now, you'll have to write unmanaged
code and then interop to access it.
-Brock
DevelopMentor
http://staff.develop.com/ballen

> I need to access the serial ports on my webserver from an asp.net
> page. I have no problem accessing the serial ports from a windows
> form application, but the code doesn't work in asp.net. I have been
> told it is not possible to access the serial ports from asp.net.
> The application is used to control custom hardware. The hardware is
> connected to a PC through serial ports. Our customer wants to control
> the hardware from a remote location so our idea was to have IIS
> running on the PC and the recorder controlled through a web page.
>
Here is a .net assembly for accessing the serial port:
http://franson.com/serialtools/index.asp?platform=net
only $30 bucks
"Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
news:360668632482173457288576@.msnews.microsoft.com...
> There are no managed APIs to connect to the serial port in v1.x. There are
> in v2.0 though. If you need a solution now, you'll have to write unmanaged
> code and then interop to access it.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>
Accessing the serial ports in .net is not the problem. Accessing the serial
ports in asp.net is the problem. Code that accesses the serial ports in a
Windows form application does not work in a asp.net application.
"Shawn H. Mesiatowsky" wrote:

> Here is a .net assembly for accessing the serial port:
> http://franson.com/serialtools/index.asp?platform=net
> only $30 bucks
> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> news:360668632482173457288576@.msnews.microsoft.com...
>
>
It's a good idea. To build a middle layer data file and
use FileSystemWatcher object to monitor the data file and
trigger event.
Elton

>--Original Message--
>I would consider a solution with a windows service
controlling the device
>and an ASP.NET application talking to the windows service
via a common
>persistent data storage, such as a file.
>Eliyahu
>"Al the programmer"
<Altheprogrammer@.discussions.microsoft.com> wrote in
>message news:4BE38333-D04D-4F22-8D88-
848840906461@.microsoft.com...
an asp.net page. I
windows form
>application,
it is not possible
>to
The hardware is
wants to control the
IIS running on the
>PC
>
>.
>
> Accessing the serial ports in .net is not the problem. Accessing the
> serial
> ports in asp.net is the problem. Code that accesses the serial ports in a
> Windows form application does not work in a asp.net application.
An ASP.Net application is a .Net application, just as a Windows Form
application is a .Net application. There is nothing you can do in a Windows
Form app that you can't do in an ASP.Net app, except with regards to the UI.
IOW, yes you can access a serial port in an ASP.Net app. Or, let me clarify:
yes -I- can access a serial port in an ASP.Net app.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
> Accessing the serial ports in .net is not the problem. Accessing the
> serial
> ports in asp.net is the problem. Code that accesses the serial ports in a
> Windows form application does not work in a asp.net application.
>
> "Shawn H. Mesiatowsky" wrote:
>
I use the serial port code that was published in MSDN magazine. It works fo
r
Windows Forms applications. It does not work in ASP.net. I have been told
by many people you cannot access serial ports from ASP.net. Telling me you
can access the serial ports doesn't do me any good.
"Kevin Spencer" wrote:

> An ASP.Net application is a .Net application, just as a Windows Form
> application is a .Net application. There is nothing you can do in a Window
s
> Form app that you can't do in an ASP.Net app, except with regards to the U
I.
> IOW, yes you can access a serial port in an ASP.Net app. Or, let me clarif
y:
> yes -I- can access a serial port in an ASP.Net app.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You S Is What You Get.
> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
>
>
>I use the serial port code that was published in MSDN magazine. It works
>for
> Windows Forms applications. It does not work in ASP.net. I have been
> told
> by many people you cannot access serial ports from ASP.net. Telling me
> you
> can access the serial ports doesn't do me any good.
Copying and pasting is not programming. And IT doesn't do you any good.
Hmmmm... Why would code that is written for, and works for a Windows Forms
app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to ask
The Amazing Kreskin.... he says it's permissions.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
>I use the serial port code that was published in MSDN magazine. It works
>for
> Windows Forms applications. It does not work in ASP.net. I have been
> told
> by many people you cannot access serial ports from ASP.net. Telling me
> you
> can access the serial ports doesn't do me any good.
>
> "Kevin Spencer" wrote:
>
> An ASP.Net application is a .Net application, just as a Windows Form
> application is a .Net application. There is nothing you can do in a
Windows
> Form app that you can't do in an ASP.Net app, except with regards to the
UI.
Some tasks are definitely not good for ASP.NET. For example, multithreading.
And recently someone asked about watching a directory from an ASP.NET
application. Although you can use a filewatcher during the page lifetime, it
obviously doesn't serve any purpose .
Eliyahu

serial port access from asp.net

I need to access the serial ports on my webserver from an asp.net page. I
have no problem accessing the serial ports from a windows form application,
but the code doesn't work in asp.net. I have been told it is not possible to
access the serial ports from asp.net.

The application is used to control custom hardware. The hardware is
connected to a PC through serial ports. Our customer wants to control the
hardware from a remote location so our idea was to have IIS running on the PC
and the recorder controlled through a web page.I would consider a solution with a windows service controlling the device
and an ASP.NET application talking to the windows service via a common
persistent data storage, such as a file.

Eliyahu

"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:4BE38333-D04D-4F22-8D88-848840906461@.microsoft.com...
> I need to access the serial ports on my webserver from an asp.net page. I
> have no problem accessing the serial ports from a windows form
application,
> but the code doesn't work in asp.net. I have been told it is not possible
to
> access the serial ports from asp.net.
> The application is used to control custom hardware. The hardware is
> connected to a PC through serial ports. Our customer wants to control the
> hardware from a remote location so our idea was to have IIS running on the
PC
> and the recorder controlled through a web page.
There are no managed APIs to connect to the serial port in v1.x. There are
in v2.0 though. If you need a solution now, you'll have to write unmanaged
code and then interop to access it.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> I need to access the serial ports on my webserver from an asp.net
> page. I have no problem accessing the serial ports from a windows
> form application, but the code doesn't work in asp.net. I have been
> told it is not possible to access the serial ports from asp.net.
> The application is used to control custom hardware. The hardware is
> connected to a PC through serial ports. Our customer wants to control
> the hardware from a remote location so our idea was to have IIS
> running on the PC and the recorder controlled through a web page.
Here is a .net assembly for accessing the serial port:

http://franson.com/serialtools/index.asp?platform=net
only $30 bucks

"Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
news:360668632482173457288576@.msnews.microsoft.com ...
> There are no managed APIs to connect to the serial port in v1.x. There are
> in v2.0 though. If you need a solution now, you'll have to write unmanaged
> code and then interop to access it.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>> I need to access the serial ports on my webserver from an asp.net
>> page. I have no problem accessing the serial ports from a windows
>> form application, but the code doesn't work in asp.net. I have been
>> told it is not possible to access the serial ports from asp.net.
>>
>> The application is used to control custom hardware. The hardware is
>> connected to a PC through serial ports. Our customer wants to control
>> the hardware from a remote location so our idea was to have IIS
>> running on the PC and the recorder controlled through a web page.
>>
Accessing the serial ports in .net is not the problem. Accessing the serial
ports in asp.net is the problem. Code that accesses the serial ports in a
Windows form application does not work in a asp.net application.

"Shawn H. Mesiatowsky" wrote:

> Here is a .net assembly for accessing the serial port:
> http://franson.com/serialtools/index.asp?platform=net
> only $30 bucks
> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> news:360668632482173457288576@.msnews.microsoft.com ...
> > There are no managed APIs to connect to the serial port in v1.x. There are
> > in v2.0 though. If you need a solution now, you'll have to write unmanaged
> > code and then interop to access it.
> > -Brock
> > DevelopMentor
> > http://staff.develop.com/ballen
> >> I need to access the serial ports on my webserver from an asp.net
> >> page. I have no problem accessing the serial ports from a windows
> >> form application, but the code doesn't work in asp.net. I have been
> >> told it is not possible to access the serial ports from asp.net.
> >>
> >> The application is used to control custom hardware. The hardware is
> >> connected to a PC through serial ports. Our customer wants to control
> >> the hardware from a remote location so our idea was to have IIS
> >> running on the PC and the recorder controlled through a web page.
> >>
>
It's a good idea. To build a middle layer data file and
use FileSystemWatcher object to monitor the data file and
trigger event.

Elton

>--Original Message--
>I would consider a solution with a windows service
controlling the device
>and an ASP.NET application talking to the windows service
via a common
>persistent data storage, such as a file.
>Eliyahu
>"Al the programmer"
<Altheprogrammer@.discussions.microsoft.com> wrote in
>message news:4BE38333-D04D-4F22-8D88-
848840906461@.microsoft.com...
>> I need to access the serial ports on my webserver from
an asp.net page. I
>> have no problem accessing the serial ports from a
windows form
>application,
>> but the code doesn't work in asp.net. I have been told
it is not possible
>to
>> access the serial ports from asp.net.
>>
>> The application is used to control custom hardware.
The hardware is
>> connected to a PC through serial ports. Our customer
wants to control the
>> hardware from a remote location so our idea was to have
IIS running on the
>PC
>> and the recorder controlled through a web page.
>
>.
> Accessing the serial ports in .net is not the problem. Accessing the
> serial
> ports in asp.net is the problem. Code that accesses the serial ports in a
> Windows form application does not work in a asp.net application.

An ASP.Net application is a .Net application, just as a Windows Form
application is a .Net application. There is nothing you can do in a Windows
Form app that you can't do in an ASP.Net app, except with regards to the UI.

IOW, yes you can access a serial port in an ASP.Net app. Or, let me clarify:
yes -I- can access a serial port in an ASP.Net app.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
> Accessing the serial ports in .net is not the problem. Accessing the
> serial
> ports in asp.net is the problem. Code that accesses the serial ports in a
> Windows form application does not work in a asp.net application.
>
> "Shawn H. Mesiatowsky" wrote:
>> Here is a .net assembly for accessing the serial port:
>>
>> http://franson.com/serialtools/index.asp?platform=net
>> only $30 bucks
>>
>> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
>> news:360668632482173457288576@.msnews.microsoft.com ...
>> > There are no managed APIs to connect to the serial port in v1.x. There
>> > are
>> > in v2.0 though. If you need a solution now, you'll have to write
>> > unmanaged
>> > code and then interop to access it.
>>> > -Brock
>> > DevelopMentor
>> > http://staff.develop.com/ballen
>>>>> >> I need to access the serial ports on my webserver from an asp.net
>> >> page. I have no problem accessing the serial ports from a windows
>> >> form application, but the code doesn't work in asp.net. I have been
>> >> told it is not possible to access the serial ports from asp.net.
>> >>
>> >> The application is used to control custom hardware. The hardware is
>> >> connected to a PC through serial ports. Our customer wants to control
>> >> the hardware from a remote location so our idea was to have IIS
>> >> running on the PC and the recorder controlled through a web page.
>> >>
>>>>>
>>
>
I use the serial port code that was published in MSDN magazine. It works for
Windows Forms applications. It does not work in ASP.net. I have been told
by many people you cannot access serial ports from ASP.net. Telling me you
can access the serial ports doesn't do me any good.

"Kevin Spencer" wrote:

> > Accessing the serial ports in .net is not the problem. Accessing the
> > serial
> > ports in asp.net is the problem. Code that accesses the serial ports in a
> > Windows form application does not work in a asp.net application.
> An ASP.Net application is a .Net application, just as a Windows Form
> application is a .Net application. There is nothing you can do in a Windows
> Form app that you can't do in an ASP.Net app, except with regards to the UI.
> IOW, yes you can access a serial port in an ASP.Net app. Or, let me clarify:
> yes -I- can access a serial port in an ASP.Net app.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
> > Accessing the serial ports in .net is not the problem. Accessing the
> > serial
> > ports in asp.net is the problem. Code that accesses the serial ports in a
> > Windows form application does not work in a asp.net application.
> > "Shawn H. Mesiatowsky" wrote:
> >> Here is a .net assembly for accessing the serial port:
> >>
> >> http://franson.com/serialtools/index.asp?platform=net
> >> only $30 bucks
> >>
> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> >> news:360668632482173457288576@.msnews.microsoft.com ...
> >> > There are no managed APIs to connect to the serial port in v1.x. There
> >> > are
> >> > in v2.0 though. If you need a solution now, you'll have to write
> >> > unmanaged
> >> > code and then interop to access it.
> >> >> > -Brock
> >> > DevelopMentor
> >> > http://staff.develop.com/ballen
> >> >> >> >> >> I need to access the serial ports on my webserver from an asp.net
> >> >> page. I have no problem accessing the serial ports from a windows
> >> >> form application, but the code doesn't work in asp.net. I have been
> >> >> told it is not possible to access the serial ports from asp.net.
> >> >>
> >> >> The application is used to control custom hardware. The hardware is
> >> >> connected to a PC through serial ports. Our customer wants to control
> >> >> the hardware from a remote location so our idea was to have IIS
> >> >> running on the PC and the recorder controlled through a web page.
> >> >>
> >> >> >> >>
> >>
> >>
>
>I use the serial port code that was published in MSDN magazine. It works
>for
> Windows Forms applications. It does not work in ASP.net. I have been
> told
> by many people you cannot access serial ports from ASP.net. Telling me
> you
> can access the serial ports doesn't do me any good.

Copying and pasting is not programming. And IT doesn't do you any good.

Hmmmm... Why would code that is written for, and works for a Windows Forms
app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to ask
The Amazing Kreskin.... he says it's permissions.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
>I use the serial port code that was published in MSDN magazine. It works
>for
> Windows Forms applications. It does not work in ASP.net. I have been
> told
> by many people you cannot access serial ports from ASP.net. Telling me
> you
> can access the serial ports doesn't do me any good.
>
> "Kevin Spencer" wrote:
>> > Accessing the serial ports in .net is not the problem. Accessing the
>> > serial
>> > ports in asp.net is the problem. Code that accesses the serial ports
>> > in a
>> > Windows form application does not work in a asp.net application.
>>
>> An ASP.Net application is a .Net application, just as a Windows Form
>> application is a .Net application. There is nothing you can do in a
>> Windows
>> Form app that you can't do in an ASP.Net app, except with regards to the
>> UI.
>>
>> IOW, yes you can access a serial port in an ASP.Net app. Or, let me
>> clarify:
>> yes -I- can access a serial port in an ASP.Net app.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> What You Seek Is What You Get.
>>
>> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
>> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
>> > Accessing the serial ports in .net is not the problem. Accessing the
>> > serial
>> > ports in asp.net is the problem. Code that accesses the serial ports
>> > in a
>> > Windows form application does not work in a asp.net application.
>>>> > "Shawn H. Mesiatowsky" wrote:
>>> >> Here is a .net assembly for accessing the serial port:
>> >>
>> >> http://franson.com/serialtools/index.asp?platform=net
>> >> only $30 bucks
>> >>
>> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
>> >> news:360668632482173457288576@.msnews.microsoft.com ...
>> >> > There are no managed APIs to connect to the serial port in v1.x.
>> >> > There
>> >> > are
>> >> > in v2.0 though. If you need a solution now, you'll have to write
>> >> > unmanaged
>> >> > code and then interop to access it.
>> >>> >> > -Brock
>> >> > DevelopMentor
>> >> > http://staff.develop.com/ballen
>> >>> >>> >>> >> >> I need to access the serial ports on my webserver from an asp.net
>> >> >> page. I have no problem accessing the serial ports from a windows
>> >> >> form application, but the code doesn't work in asp.net. I have
>> >> >> been
>> >> >> told it is not possible to access the serial ports from asp.net.
>> >> >>
>> >> >> The application is used to control custom hardware. The hardware
>> >> >> is
>> >> >> connected to a PC through serial ports. Our customer wants to
>> >> >> control
>> >> >> the hardware from a remote location so our idea was to have IIS
>> >> >> running on the PC and the recorder controlled through a web page.
>> >> >>
>> >>> >>> >>> >>
>> >>
>> >>
>>
>>
>
> An ASP.Net application is a .Net application, just as a Windows Form
> application is a .Net application. There is nothing you can do in a
Windows
> Form app that you can't do in an ASP.Net app, except with regards to the
UI.

Some tasks are definitely not good for ASP.NET. For example, multithreading.
And recently someone asked about watching a directory from an ASP.NET
application. Although you can use a filewatcher during the page lifetime, it
obviously doesn't serve any purpose .

Eliyahu
The problem is not permissions. ASPNET and IUSR have administrator
priviledges on the computer. The Windows API calls for serial ports don't
work under ASP.net.

"Kevin Spencer" wrote:

> >I use the serial port code that was published in MSDN magazine. It works
> >for
> > Windows Forms applications. It does not work in ASP.net. I have been
> > told
> > by many people you cannot access serial ports from ASP.net. Telling me
> > you
> > can access the serial ports doesn't do me any good.
> Copying and pasting is not programming. And IT doesn't do you any good.
> Hmmmm... Why would code that is written for, and works for a Windows Forms
> app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to ask
> The Amazing Kreskin.... he says it's permissions.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
> >I use the serial port code that was published in MSDN magazine. It works
> >for
> > Windows Forms applications. It does not work in ASP.net. I have been
> > told
> > by many people you cannot access serial ports from ASP.net. Telling me
> > you
> > can access the serial ports doesn't do me any good.
> > "Kevin Spencer" wrote:
> >> > Accessing the serial ports in .net is not the problem. Accessing the
> >> > serial
> >> > ports in asp.net is the problem. Code that accesses the serial ports
> >> > in a
> >> > Windows form application does not work in a asp.net application.
> >>
> >> An ASP.Net application is a .Net application, just as a Windows Form
> >> application is a .Net application. There is nothing you can do in a
> >> Windows
> >> Form app that you can't do in an ASP.Net app, except with regards to the
> >> UI.
> >>
> >> IOW, yes you can access a serial port in an ASP.Net app. Or, let me
> >> clarify:
> >> yes -I- can access a serial port in an ASP.Net app.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> ..Net Developer
> >> What You Seek Is What You Get.
> >>
> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> >> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
> >> > Accessing the serial ports in .net is not the problem. Accessing the
> >> > serial
> >> > ports in asp.net is the problem. Code that accesses the serial ports
> >> > in a
> >> > Windows form application does not work in a asp.net application.
> >> >> >> > "Shawn H. Mesiatowsky" wrote:
> >> >> >> Here is a .net assembly for accessing the serial port:
> >> >>
> >> >> http://franson.com/serialtools/index.asp?platform=net
> >> >> only $30 bucks
> >> >>
> >> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> >> >> news:360668632482173457288576@.msnews.microsoft.com ...
> >> >> > There are no managed APIs to connect to the serial port in v1.x.
> >> >> > There
> >> >> > are
> >> >> > in v2.0 though. If you need a solution now, you'll have to write
> >> >> > unmanaged
> >> >> > code and then interop to access it.
> >> >> >> >> > -Brock
> >> >> > DevelopMentor
> >> >> > http://staff.develop.com/ballen
> >> >> >> >> >> >> >> >> >> I need to access the serial ports on my webserver from an asp.net
> >> >> >> page. I have no problem accessing the serial ports from a windows
> >> >> >> form application, but the code doesn't work in asp.net. I have
> >> >> >> been
> >> >> >> told it is not possible to access the serial ports from asp.net.
> >> >> >>
> >> >> >> The application is used to control custom hardware. The hardware
> >> >> >> is
> >> >> >> connected to a PC through serial ports. Our customer wants to
> >> >> >> control
> >> >> >> the hardware from a remote location so our idea was to have IIS
> >> >> >> running on the PC and the recorder controlled through a web page.
> >> >> >>
> >> >> >> >> >> >> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
> The problem is not permissions. ASPNET and IUSR have administrator
> priviledges on the computer. The Windows API calls for serial ports don't
> work under ASP.net.

Well, darn. I suppose my apps only LOOK like they work...

Then again, I didn't copy them from anything.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:B8924CFF-D490-4404-8BC9-7A761C4CA330@.microsoft.com...
> The problem is not permissions. ASPNET and IUSR have administrator
> priviledges on the computer. The Windows API calls for serial ports don't
> work under ASP.net.
>
> "Kevin Spencer" wrote:
>> >I use the serial port code that was published in MSDN magazine. It
>> >works
>> >for
>> > Windows Forms applications. It does not work in ASP.net. I have been
>> > told
>> > by many people you cannot access serial ports from ASP.net. Telling me
>> > you
>> > can access the serial ports doesn't do me any good.
>>
>> Copying and pasting is not programming. And IT doesn't do you any good.
>>
>> Hmmmm... Why would code that is written for, and works for a Windows
>> Forms
>> app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to
>> ask
>> The Amazing Kreskin.... he says it's permissions.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> What You Seek Is What You Get.
>>
>> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
>> message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
>> >I use the serial port code that was published in MSDN magazine. It
>> >works
>> >for
>> > Windows Forms applications. It does not work in ASP.net. I have been
>> > told
>> > by many people you cannot access serial ports from ASP.net. Telling me
>> > you
>> > can access the serial ports doesn't do me any good.
>>>> > "Kevin Spencer" wrote:
>>> >> > Accessing the serial ports in .net is not the problem. Accessing
>> >> > the
>> >> > serial
>> >> > ports in asp.net is the problem. Code that accesses the serial
>> >> > ports
>> >> > in a
>> >> > Windows form application does not work in a asp.net application.
>> >>
>> >> An ASP.Net application is a .Net application, just as a Windows Form
>> >> application is a .Net application. There is nothing you can do in a
>> >> Windows
>> >> Form app that you can't do in an ASP.Net app, except with regards to
>> >> the
>> >> UI.
>> >>
>> >> IOW, yes you can access a serial port in an ASP.Net app. Or, let me
>> >> clarify:
>> >> yes -I- can access a serial port in an ASP.Net app.
>> >>
>> >> --
>> >> HTH,
>> >>
>> >> Kevin Spencer
>> >> Microsoft MVP
>> >> ..Net Developer
>> >> What You Seek Is What You Get.
>> >>
>> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote
>> >> in
>> >> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
>> >> > Accessing the serial ports in .net is not the problem. Accessing
>> >> > the
>> >> > serial
>> >> > ports in asp.net is the problem. Code that accesses the serial
>> >> > ports
>> >> > in a
>> >> > Windows form application does not work in a asp.net application.
>> >>> >>> >> > "Shawn H. Mesiatowsky" wrote:
>> >>> >> >> Here is a .net assembly for accessing the serial port:
>> >> >>
>> >> >> http://franson.com/serialtools/index.asp?platform=net
>> >> >> only $30 bucks
>> >> >>
>> >> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
>> >> >> news:360668632482173457288576@.msnews.microsoft.com ...
>> >> >> > There are no managed APIs to connect to the serial port in v1.x.
>> >> >> > There
>> >> >> > are
>> >> >> > in v2.0 though. If you need a solution now, you'll have to write
>> >> >> > unmanaged
>> >> >> > code and then interop to access it.
>> >> >>> >> >> > -Brock
>> >> >> > DevelopMentor
>> >> >> > http://staff.develop.com/ballen
>> >> >>> >> >>> >> >>> >> >> >> I need to access the serial ports on my webserver from an
>> >> >> >> asp.net
>> >> >> >> page. I have no problem accessing the serial ports from a
>> >> >> >> windows
>> >> >> >> form application, but the code doesn't work in asp.net. I have
>> >> >> >> been
>> >> >> >> told it is not possible to access the serial ports from asp.net.
>> >> >> >>
>> >> >> >> The application is used to control custom hardware. The
>> >> >> >> hardware
>> >> >> >> is
>> >> >> >> connected to a PC through serial ports. Our customer wants to
>> >> >> >> control
>> >> >> >> the hardware from a remote location so our idea was to have IIS
>> >> >> >> running on the PC and the recorder controlled through a web
>> >> >> >> page.
>> >> >> >>
>> >> >>> >> >>> >> >>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>
Since you are unable to supply any useful information I can only assume you
don't know anything. Judging by your attitude you are probably a teenager.

"Kevin Spencer" wrote:

> > The problem is not permissions. ASPNET and IUSR have administrator
> > priviledges on the computer. The Windows API calls for serial ports don't
> > work under ASP.net.
> Well, darn. I suppose my apps only LOOK like they work...
> Then again, I didn't copy them from anything.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> message news:B8924CFF-D490-4404-8BC9-7A761C4CA330@.microsoft.com...
> > The problem is not permissions. ASPNET and IUSR have administrator
> > priviledges on the computer. The Windows API calls for serial ports don't
> > work under ASP.net.
> > "Kevin Spencer" wrote:
> >> >I use the serial port code that was published in MSDN magazine. It
> >> >works
> >> >for
> >> > Windows Forms applications. It does not work in ASP.net. I have been
> >> > told
> >> > by many people you cannot access serial ports from ASP.net. Telling me
> >> > you
> >> > can access the serial ports doesn't do me any good.
> >>
> >> Copying and pasting is not programming. And IT doesn't do you any good.
> >>
> >> Hmmmm... Why would code that is written for, and works for a Windows
> >> Forms
> >> app not work in an ASP.Net app? Well, I haven't seen it, so I'll have to
> >> ask
> >> The Amazing Kreskin.... he says it's permissions.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> ..Net Developer
> >> What You Seek Is What You Get.
> >>
> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
> >> message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
> >> >I use the serial port code that was published in MSDN magazine. It
> >> >works
> >> >for
> >> > Windows Forms applications. It does not work in ASP.net. I have been
> >> > told
> >> > by many people you cannot access serial ports from ASP.net. Telling me
> >> > you
> >> > can access the serial ports doesn't do me any good.
> >> >> >> > "Kevin Spencer" wrote:
> >> >> >> > Accessing the serial ports in .net is not the problem. Accessing
> >> >> > the
> >> >> > serial
> >> >> > ports in asp.net is the problem. Code that accesses the serial
> >> >> > ports
> >> >> > in a
> >> >> > Windows form application does not work in a asp.net application.
> >> >>
> >> >> An ASP.Net application is a .Net application, just as a Windows Form
> >> >> application is a .Net application. There is nothing you can do in a
> >> >> Windows
> >> >> Form app that you can't do in an ASP.Net app, except with regards to
> >> >> the
> >> >> UI.
> >> >>
> >> >> IOW, yes you can access a serial port in an ASP.Net app. Or, let me
> >> >> clarify:
> >> >> yes -I- can access a serial port in an ASP.Net app.
> >> >>
> >> >> --
> >> >> HTH,
> >> >>
> >> >> Kevin Spencer
> >> >> Microsoft MVP
> >> >> ..Net Developer
> >> >> What You Seek Is What You Get.
> >> >>
> >> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote
> >> >> in
> >> >> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
> >> >> > Accessing the serial ports in .net is not the problem. Accessing
> >> >> > the
> >> >> > serial
> >> >> > ports in asp.net is the problem. Code that accesses the serial
> >> >> > ports
> >> >> > in a
> >> >> > Windows form application does not work in a asp.net application.
> >> >> >> >> >> >> > "Shawn H. Mesiatowsky" wrote:
> >> >> >> >> >> Here is a .net assembly for accessing the serial port:
> >> >> >>
> >> >> >> http://franson.com/serialtools/index.asp?platform=net
> >> >> >> only $30 bucks
> >> >> >>
> >> >> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> >> >> >> news:360668632482173457288576@.msnews.microsoft.com ...
> >> >> >> > There are no managed APIs to connect to the serial port in v1.x.
> >> >> >> > There
> >> >> >> > are
> >> >> >> > in v2.0 though. If you need a solution now, you'll have to write
> >> >> >> > unmanaged
> >> >> >> > code and then interop to access it.
> >> >> >> >> >> >> > -Brock
> >> >> >> > DevelopMentor
> >> >> >> > http://staff.develop.com/ballen
> >> >> >> >> >> >> >> >> >> >> >> >> >> I need to access the serial ports on my webserver from an
> >> >> >> >> asp.net
> >> >> >> >> page. I have no problem accessing the serial ports from a
> >> >> >> >> windows
> >> >> >> >> form application, but the code doesn't work in asp.net. I have
> >> >> >> >> been
> >> >> >> >> told it is not possible to access the serial ports from asp.net.
> >> >> >> >>
> >> >> >> >> The application is used to control custom hardware. The
> >> >> >> >> hardware
> >> >> >> >> is
> >> >> >> >> connected to a PC through serial ports. Our customer wants to
> >> >> >> >> control
> >> >> >> >> the hardware from a remote location so our idea was to have IIS
> >> >> >> >> running on the PC and the recorder controlled through a web
> >> >> >> >> page.
> >> >> >> >>
> >> >> >> >> >> >> >> >> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
> Since you are unable to supply any useful information I can only assume
> you
> don't know anything. Judging by your attitude you are probably a
> teenager.

Well, you're wrong on point 2 - I am 49 years old. Could it be that you're
wrong about anything else? Well, logically, one could make that prediction.

If by "unable to supply any useful information" you mean I can't write your
code for you, your assumption is patently incorrect. I am perfectly capable
of writing code, yours or anyone else's. However, we seem to have a
disagreement about how "useful" my advice is.

If your child asked you for a piece of cake just before dinner, would you be
helping him/her by giving it to him/her? Similarly, I try to help people by
telling them what they need to know, not necessarily what they think they
want to know. Yeah, I know, it doesn't taste like cake. But it's good for
you!

Let me illustrate by quoting you:

>> >> >> > Accessing the serial ports in .net is not the problem. Accessing
>> >> >> > the
>> >> >> > serial
>> >> >> > ports in asp.net is the problem. Code that accesses the serial
>> >> >> > ports
>> >> >> > in a
>> >> >> > Windows form application does not work in a asp.net application.

This statement is full of assumptions, almost all of them wrong. It
indicates that you can't seem to write code for yourself, that you copied
code from an example without studying and understanding it, and that you
assume the fault is with the platform. Getting a feed from a serial port is
an academic exercise. Knowing how to program, understanding logic, and best
practices are indispensible. If I wrote code for you that accesses a serial
port, you would have a small problem solved, but the cause ignored. If, on
the other hand, you learn how to really program, not just put pieces
together like a Jigsaw puzzle, and you disciplined your logic, and learned
and practiced best practices, the first problem would be solved, and any
future problems of that nature would disappear.

So, if I'm guilty of being "useless," perhaps it's your idea of "useless"
that is at fault.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
message news:A6351A12-1137-4204-895E-1BF80E588489@.microsoft.com...
> Since you are unable to supply any useful information I can only assume
> you
> don't know anything. Judging by your attitude you are probably a
> teenager.
>
> "Kevin Spencer" wrote:
>> > The problem is not permissions. ASPNET and IUSR have administrator
>> > priviledges on the computer. The Windows API calls for serial ports
>> > don't
>> > work under ASP.net.
>>
>> Well, darn. I suppose my apps only LOOK like they work...
>>
>> Then again, I didn't copy them from anything.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> What You Seek Is What You Get.
>>
>> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote in
>> message news:B8924CFF-D490-4404-8BC9-7A761C4CA330@.microsoft.com...
>> > The problem is not permissions. ASPNET and IUSR have administrator
>> > priviledges on the computer. The Windows API calls for serial ports
>> > don't
>> > work under ASP.net.
>>>> > "Kevin Spencer" wrote:
>>> >> >I use the serial port code that was published in MSDN magazine. It
>> >> >works
>> >> >for
>> >> > Windows Forms applications. It does not work in ASP.net. I have
>> >> > been
>> >> > told
>> >> > by many people you cannot access serial ports from ASP.net. Telling
>> >> > me
>> >> > you
>> >> > can access the serial ports doesn't do me any good.
>> >>
>> >> Copying and pasting is not programming. And IT doesn't do you any
>> >> good.
>> >>
>> >> Hmmmm... Why would code that is written for, and works for a Windows
>> >> Forms
>> >> app not work in an ASP.Net app? Well, I haven't seen it, so I'll have
>> >> to
>> >> ask
>> >> The Amazing Kreskin.... he says it's permissions.
>> >>
>> >> --
>> >> HTH,
>> >>
>> >> Kevin Spencer
>> >> Microsoft MVP
>> >> ..Net Developer
>> >> What You Seek Is What You Get.
>> >>
>> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com> wrote
>> >> in
>> >> message news:77A8DB7E-1E7A-4E3C-80E7-9AB6A05425CB@.microsoft.com...
>> >> >I use the serial port code that was published in MSDN magazine. It
>> >> >works
>> >> >for
>> >> > Windows Forms applications. It does not work in ASP.net. I have
>> >> > been
>> >> > told
>> >> > by many people you cannot access serial ports from ASP.net. Telling
>> >> > me
>> >> > you
>> >> > can access the serial ports doesn't do me any good.
>> >>> >>> >> > "Kevin Spencer" wrote:
>> >>> >> >> > Accessing the serial ports in .net is not the problem. Accessing
>> >> >> > the
>> >> >> > serial
>> >> >> > ports in asp.net is the problem. Code that accesses the serial
>> >> >> > ports
>> >> >> > in a
>> >> >> > Windows form application does not work in a asp.net application.
>> >> >>
>> >> >> An ASP.Net application is a .Net application, just as a Windows
>> >> >> Form
>> >> >> application is a .Net application. There is nothing you can do in a
>> >> >> Windows
>> >> >> Form app that you can't do in an ASP.Net app, except with regards
>> >> >> to
>> >> >> the
>> >> >> UI.
>> >> >>
>> >> >> IOW, yes you can access a serial port in an ASP.Net app. Or, let me
>> >> >> clarify:
>> >> >> yes -I- can access a serial port in an ASP.Net app.
>> >> >>
>> >> >> --
>> >> >> HTH,
>> >> >>
>> >> >> Kevin Spencer
>> >> >> Microsoft MVP
>> >> >> ..Net Developer
>> >> >> What You Seek Is What You Get.
>> >> >>
>> >> >> "Al the programmer" <Altheprogrammer@.discussions.microsoft.com>
>> >> >> wrote
>> >> >> in
>> >> >> message news:4C910B4E-F34D-40CD-8930-D1CB45DD0DDA@.microsoft.com...
>> >> >> > Accessing the serial ports in .net is not the problem. Accessing
>> >> >> > the
>> >> >> > serial
>> >> >> > ports in asp.net is the problem. Code that accesses the serial
>> >> >> > ports
>> >> >> > in a
>> >> >> > Windows form application does not work in a asp.net application.
>> >> >>> >> >>> >> >> > "Shawn H. Mesiatowsky" wrote:
>> >> >>> >> >> >> Here is a .net assembly for accessing the serial port:
>> >> >> >>
>> >> >> >> http://franson.com/serialtools/index.asp?platform=net
>> >> >> >> only $30 bucks
>> >> >> >>
>> >> >> >> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
>> >> >> >> news:360668632482173457288576@.msnews.microsoft.com ...
>> >> >> >> > There are no managed APIs to connect to the serial port in
>> >> >> >> > v1.x.
>> >> >> >> > There
>> >> >> >> > are
>> >> >> >> > in v2.0 though. If you need a solution now, you'll have to
>> >> >> >> > write
>> >> >> >> > unmanaged
>> >> >> >> > code and then interop to access it.
>> >> >> >>> >> >> >> > -Brock
>> >> >> >> > DevelopMentor
>> >> >> >> > http://staff.develop.com/ballen
>> >> >> >>> >> >> >>> >> >> >>> >> >> >> >> I need to access the serial ports on my webserver from an
>> >> >> >> >> asp.net
>> >> >> >> >> page. I have no problem accessing the serial ports from a
>> >> >> >> >> windows
>> >> >> >> >> form application, but the code doesn't work in asp.net. I
>> >> >> >> >> have
>> >> >> >> >> been
>> >> >> >> >> told it is not possible to access the serial ports from
>> >> >> >> >> asp.net.
>> >> >> >> >>
>> >> >> >> >> The application is used to control custom hardware. The
>> >> >> >> >> hardware
>> >> >> >> >> is
>> >> >> >> >> connected to a PC through serial ports. Our customer wants
>> >> >> >> >> to
>> >> >> >> >> control
>> >> >> >> >> the hardware from a remote location so our idea was to have
>> >> >> >> >> IIS
>> >> >> >> >> running on the PC and the recorder controlled through a web
>> >> >> >> >> page.
>> >> >> >> >>
>> >> >> >>> >> >> >>> >> >> >>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>

Serial Port access

I am using VS2005 C# to create an ASP.Net application involving accessing a device in a packing machine via Serial Port.

I am trying using DataReceived event of SerialPort class to read the data from Serial Port in the web page, but I am having the problem on reading the data back and not sure how to do.

By reading from forums, I learned that server created a secondary thread for Serial Comm.

Anyone with any idea, please help.

Thanks.

waitingCrying


Hi mwang,

I think you can use the winforms sample for serial port accessing in ASP.NET. But need to take care of the identity and security setting.

Thursday, March 22, 2012

Server access to files on the LAN

Hi,

My asp.net application must access a file that can be
anywhere on the server's LAN. I am having a problem
because the server, doesn't have access to files that are
not on the server's local disk. I have done similar
things using COM+ and COM dlls in older versions of asp.
I would have the file access code in a COM dll, run the
dll in COM+, and in COM+, enter a UN and PW that would
have LAN privilege that the COM object would execute on
behalf of. Currently, my file access code is in a dll
written in VB.NET. Is there a way I can give the dll
access to the LAN like I used to do in MTS/COM+? Should I
be handling it differently?

Any help would be appreciated.

Jerry JDo some research on Impersonation for ASP.net.

Look at this part of your machine.config file on your webserver:

<!--
identity Attributes:
impersonate="[true|false]" - Impersonate Windows User
userName="Windows user account to impersonate" | empty string
implies impersonate the LOGON user specified by IIS
password="password of above specified account" | empty string
-->
<identity impersonate="false" userName="" password=""/
Be careful...if ASP.NET run's as a user with elevated privildges, that could
cause some security concerns.

Michael

"Jerry J" <anonymous@.discussions.microsoft.com> wrote in message
news:00f201c3cefd$2eed3090$a301280a@.phx.gbl...
> Hi,
> My asp.net application must access a file that can be
> anywhere on the server's LAN. I am having a problem
> because the server, doesn't have access to files that are
> not on the server's local disk. I have done similar
> things using COM+ and COM dlls in older versions of asp.
> I would have the file access code in a COM dll, run the
> dll in COM+, and in COM+, enter a UN and PW that would
> have LAN privilege that the COM object would execute on
> behalf of. Currently, my file access code is in a dll
> written in VB.NET. Is there a way I can give the dll
> access to the LAN like I used to do in MTS/COM+? Should I
> be handling it differently?
> Any help would be appreciated.
> Jerry J

--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003
Right... security is really up to you, and I would do more research rather
than blindly using a suggestion found here -- not because the suggestions
are invalid or wrong, but because we know little about your application and
who's using it.

Think about your application's users, functionality involved, and create a
security model before choosing how to best implement a solution here.

Check out the impersonation support in the web.config file -- but this will
affect every request to your asp app. Also check out IIS settings, and
think about turning off anonymous access and allow IIS to consume
authentication info on each web request -- tieing into domain
authentication.

---------------------
This reply is provided AS IS, without warranty (express or implied).

-------
>Content-Class: urn:content-classes:message
>From: "Jerry J" <anonymous@.discussions.microsoft.com>
>Sender: "Jerry J" <anonymous@.discussions.microsoft.com>
>Subject: Server access to files on the LAN
>Date: Tue, 30 Dec 2003 09:48:50 -0800
>Lines: 19
>Message-ID: <00f201c3cefd$2eed3090$a301280a@.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Thread-Index: AcPO/S7qNhGQDfu+S4q0gYPNbYUXYw==
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa07.phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:198909
>NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>Hi,
>My asp.net application must access a file that can be
>anywhere on the server's LAN. I am having a problem
>because the server, doesn't have access to files that are
>not on the server's local disk. I have done similar
>things using COM+ and COM dlls in older versions of asp.
>I would have the file access code in a COM dll, run the
>dll in COM+, and in COM+, enter a UN and PW that would
>have LAN privilege that the COM object would execute on
>behalf of. Currently, my file access code is in a dll
>written in VB.NET. Is there a way I can give the dll
>access to the LAN like I used to do in MTS/COM+? Should I
>be handling it differently?
>Any help would be appreciated.
>Jerry J
Hi,
You can have a look on setting security policy for the dll
which needs the LAN privilege by using tools like Caspol.You set the
permissionSet as "LocalIntranet"
HTH

"Jerry J" <anonymous@.discussions.microsoft.com> wrote in message
news:00f201c3cefd$2eed3090$a301280a@.phx.gbl...
> Hi,
> My asp.net application must access a file that can be
> anywhere on the server's LAN. I am having a problem
> because the server, doesn't have access to files that are
> not on the server's local disk. I have done similar
> things using COM+ and COM dlls in older versions of asp.
> I would have the file access code in a COM dll, run the
> dll in COM+, and in COM+, enter a UN and PW that would
> have LAN privilege that the COM object would execute on
> behalf of. Currently, my file access code is in a dll
> written in VB.NET. Is there a way I can give the dll
> access to the LAN like I used to do in MTS/COM+? Should I
> be handling it differently?
> Any help would be appreciated.
> Jerry J

Tuesday, March 13, 2012

Server App Unavailable Error

I have a web service that I can access from a client machine as long as that web service is on the machine I delevoped it on. I created a virtual directory on our server's (Small Business Server 2000) internet information server and put all of the web service's files in the inetpub/wwwroot folder. However, when I try to access the web service while it's on the server I get an error that says that the server application is unavailable.

The error says to reference the system logs for a detailed description of the failure. When looking at the Event Viewer on the server the following error shows up:

"aspnet_wp.exe could not be launched because the username and/or password supplied in the processModel section of the config file are invalid"

I'm new to asp.net. Does anyone have any insight as to why this is happening?

Thanks in advance.http://support.microsoft.com/default.aspx?scid=kb;en-us;q315158&

CAUSE
By default, ASP.NET runs its worker process (Aspnet_wp.exe) with a weak account (the local machine account, which is named ASPNET) to provide a more secure environment. On a domain controller or on a backup domain controller, all user accounts are domain accounts and are not local machine accounts. Therefore, Aspnet_wp.exe fails to start because it cannot find a local account named "localmachinename\ASPNET". To provide a valid user account on the domain controller, you must specify an explicit account in the <processModel> section of the Machine.config file, or you must use the SYSTEM account.

etc.

Server Application Unavailable

I'm having a tough time with an asp.net application.

I'm running Win 2003 Server with IIS 6.0 and .Net 1.1 Framework.

Each time I try to access the app from a browser i get the following error.

----------------------------
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
----------------------------
Here's a entry from this mornings log file. It refers to the page I'm trying to access.
----------------------------
2004-08-18 10:02:14 10.1.5.242 GET /ConcoWebAppX/SiteContacts.aspx SiteID=1268 80 - 10.1.5.242 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 500 0 0
----------------------------
I have security set to the local IUSR_MACHINENAME account from the root down, the Authenticated Access has been tried with both Integrated Windows Authentication and nothing checked.

The Execute Permissions under the Home Directory is set to scripts only.

I'm really at a loss.

Can anyone steer me in the right direction for an answer as well as a best practice?

Thanks.

Doug DexterDid you try removing all code from the page and re-running it to ensure that it is not a coding error (for example a never ending loop)?
The code runs in development, and has even run on this 2003 server and there are several .Net pages affected by this, not just the example I've shown.

So I'm certain it's a permission issue.

Thanks.
does it involve database ?
Yes.
This thing is driving me CRAZY...

It works on XP PRO...

But it REFUSES to run on Server 2003...

Hasn't SOMEONE had this problem?
FIXED.

In the web.config file set the following:


<authorization>
<allow users="*" /> <!-- Allow all users --
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>

John 3:16

dd

Server Application Unavailable

Hi get this error

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.

Please hit the "Refresh" button in your web browser to retry your request.

but when i check the application event log and IIS log

there is nothing

do i need to have some option on for asp log the error?

if not what is causing the error?

Im running .net framework 1.1 on Windows 2000 and error happens on button postback but not all the time

just occasionally like 1 out of 30 times

is this you own designed application? Or a community start kit? It really sounds like your IIS keeps recycling. Is it possible you are changing out the files in the bin directory or writing to the web.config file?

I think try to stop and start the IIS.so that your problme may rectify.due to IIS problems some time you may get this error...or else you can try also for repairing IIS try to run following command.

regiis -i.

May help you.


ramana123:

I think try to stop and start the IIS.so that your problme may rectify.due to IIS problems some time you may get this error...or else you can try also for repairing IIS try to run following command.

regiis -i.

May help you.

I think you mean

aspnet_regiis -i

You can find this in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 or by opening up the SDK command prompt.


i made added to existing application

its is programmed in C#

i have added to the program before but never has seen this error


i added to existing application

its is programmed in C#

i have added to the program before but never has seen this error


i added to existing application

its is programmed in C#

i have added to the program before but never has seen this error


i tried using "aspnet_regiis -i " and i still get the problem

note: when i press refresh it works

its like postback event of the button is causing the error


I was play around with fp/vs express 2005 and application directories on my pc and got that error message.

1. In iis check the directory is an application directory?
2. Check the folder security look for "ASP.NET" MACHINE ACCOUNT (MYpc\aspnet) does it have the correct access?
2a. Any messages in the events?
3. Whats in your web.config (check security also)

May help


1. yes it is an application directory

2. it has the correct access

2a. no events in the event log

3. default settings in the web.config file

it does not happen everytime so i think its security


the error is caused when the asp or IIS is refreshing

so theres no way to get around it

Server Application Unavailable

I have made an .aspx file and I tried to access it throughhttp://localhost, when I type it in it brings up a page that saysServer ApplicationUnavailable. How can I access my .aspx files without this happening? I currently can't even access my .aspx files:( Please Help.Do you have ASP.NET installed and configured?
Baiju
Usually, that happens when your web server is recycling its worker process. And the most common reason for the process to restart is that you have an infinite loop in your code.
Try to start the application in debug mode from Visual Studio and look for a stack overflow exception. That should locate your loop pretty fast.
I tried a few things by uninstalling asp.net and then reinstalling it, now it shows my pages, but the asp.net script isn't showing, like it doesn't work but it is still showing it.:(

Server Application Unavailable

Help, I have Googled this to death. There are tons of threads with just as many solutions. None of which have worked for me.

Trying to access my ASP.NET page on my local machine's IIS and I get the following error:

------------------------------

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

------------------------------

Event Viewer says:
Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1084
Date: 9/9/2004
Time: 10:04:32 AM
User: N/A
Computer: WSENQ--00370PDR
Description:
aspnet_wp.exe could not be started. The error code for the failure is 80004005. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.

------------------------------

Running XP-Pro-sp1, .NET 1.1, IIS 6.0sp1I had the same problem on my machine this morning, it is 6:01 the next morning and I finnaly fixed it.

At first I had a machineName/acountName login fail error, then I changed a lot of seeting and got the error that you got: server application unavailable.

I uninstalled visual studio 2002, sqlServer because I changed so many things in there I could not fix them at my skill level. Then reinstalled them.

Then I found the following web page: http://aspnet101.com/aspnet101/tutorials.aspx?id=23

Followed the directions to a tee, but make sure in:
Step 1: Creating a Trusted SQL Server Connection

that you ALSO: not only perform the step for the administrator account but, also for the

* ASPNET_WP ACCOUNT*

Follow the rest exactly like it says. the rest of the steps only need to be performed once.
and it will work.

Hope this helps
Tom
What you need to do is go to the machine.Config file, which is located at:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG

Go to the line:

<processModel enable="true" timeout="Infinite" idleTimeout="Infinite" shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000" restartQueueLimit="10"memoryLimit="60" webGarden="false" cpuMask="0xffffffff" userName="machine" password="AutoGenerate" logLevel="Errors" clientConnectedCheck="0:00:05" comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate" responseDeadlockInterval="00:03:00" maxWorkerThreads="20" maxIoThreads="20"/
Check the bold item in the above statement, and replace it with a higher number. That number is a percentage of the total main memory that is being used by the asp.net engine. The higher the better for your application, the worst for your machine performance.

Regards.
Hi Haidar,
What are you saying? How come the memory limit affect what the users are seeing. As you can see, they are talking about the permission issues, how could a memory setting fix it. I am sorry I am not trying to ridicule it. But, What are you talking about

Thanks
Hello, this error message usually happens if you are running any application that requires much of the memory. I had this once and I was able to solve it this way. It might be this solution, but what should be done right now, is to apply this solution and see what happens.

Regards.
Hmm. It is because the aspnet_wp could not be started when you debug with the VS.NET. There is a fix for this from Microsoft. Please take a look at the article.

http://support.microsoft.com/kb/820747/EN-US/

May be it was a coincidence that it seem to work after you change the memoryLimit setting. But I sincerely dont believe it has anything to do with aspnet_wp running

Anyway Take it easy

Server Application Unavailable

Hi all,
I'm getting a "Server Application Unavailable" error message when I runa query against my database which is in MS Access. Other pages arerunning fine. Also, the query runs for some particular combinations butfor other I get this error. I'm not sure why. And all this stratedhappening suddenly. Previously, it was running without problems and Ididn't even change the code. So why now?
the web server I'm using is Windows 2000 Server. The version of ASP.NET I have is 1.1.
I viewed the event log which describes a different error every time Irefresh the page. The errors are none of those that I found aftersearching on the net and msdn.
It seems I'm getting two error messages per refresh but they all seem to be different.
I have copied the event log below:
1)
Event Type: Error
Event Source: .NET Runtime
Event Category: None
Event ID: 0
Date: 5/12/2005
Time: 9:39:21 AM
User: N/A
Computer: (omitted)
Description:
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot befound. The local computer may not have the necessary registryinformation or message DLL files to display messages from a remotecomputer. The following information is part of the event: .NET Runtimeversion 1.1.4322.573- Setup Error: Failed to load resources fromresource file
Please check your Setup.

2)
Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1008
Date: 5/12/2005
Time: 9:39:55 AM
User: N/A
Computer:
Description:
aspnet_wp.exe (PID: 3256) was recycled because it failed to respond to ping message.

3)
Event Type: Error
Event Source: .NET Runtime
Event Category: None
Event ID: 0
Date: 5/12/2005
Time: 9:51:46 AM
User: N/A
Computer:
Description:
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot befound. The local computer may not have the necessary registryinformation or message DLL files to display messages from a remotecomputer. The following information is part of the event: .NET Runtimeversion 1.1.4322.573- aspnet_wp.exe - Common Language Runtime DebuggingServices: Application has generated an exception that could not behandled.
Process id=0x1320 (4896), Thread id=0xbd0 (3024).
Click OK to terminate the application.
Click CANCEL to debug the application..

4)
Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1000
Date: 5/12/2005
Time: 9:51:46 AM
User: N/A
Computer:
Description:
aspnet_wp.exe (PID: 4896) stopped unexpectedly.
I would really appreciate any help on this. Please help me.
Thanks in advance.
Usually, this happens when you have an infinite loop in your code. This seems to be confirmed by the problem only appearing for some parameters.

Server Application Unavailable

I'm getting this error when tring to browse an ASPX file in IIS:

Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

I have no idea what to do. I can browse any other file (ASP, HTML, HTM).
I can run ASPX file through Web Matrix w/o problems, just not IIS.

ThanksWelcome to the ASP.NET Forums, rob_b_harris.

This is such a common problem that we have a dedicated forum for it:
'Server Application Unavailable' error

Be sure to read the very first thread, which describes the problem and its most common fix. If this common fix does not work for you, you can then browse the other threads to find additional information.

Server Application Unavailable

Can anyone tell me what this means.....

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note:An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.



I have ASP 1.1 up and running on IIS 5.1

Hello,
Are you using ASP.NET 2.0 application?
Since you dont use IIS 6.0 this error may occur because of version incompatibility rather than application pool problem.
regards

I am using ASP 1.1 not sure if thats what you mean. I am also using VS.NET 2003

I had it working, but I messed with some config files and options so I might have to reinstall.

Whatt do you think? This is all new to me.


Hi base836ball
If this is a new installation, you may want to turn off "Show friend HTTP error messages" to show a more detailed explanation of what went wrong.
Go to IE > Tools > Advanced tab > Check off the above.
Hope this helps
Please check this then
http://www.extremeexperts.com/Net/FAQ/ServerApplicationUnavailable.aspx
regards
Run aspnet_regiis -i
This problem some times arises because asp.net is not installed.
FIXED!!! Cant remember how though. I did so many things. I guess next time i will take it one step at a time. I did try everyones response so maybe one of you guys helped!

Server Application Unavailable

I get the following message:

Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web browser
to retry your request.

Administrator Note: An error message detailing the cause of this specific
request failure can be found in the application event log of the web server.
Please review this log entry to discover what caused this error to occur.

Event log shows me this:
aspnet_wp.exe could not be launched because the username and/or password
supplied in the processModel section of the config file are invalid.

Also get this trying to bring up VS.NET:
The web server got the following error when attempting to create or open the
web project located at the following URL: 'http://localhost/pp. 'HTTP/1.1 500
Internal Server Error'.

What do I need to do to fix this?

Thanks
Chris

--
Chris DavoliOff hand, I would guess that
> aspnet_wp.exe could not be launched because the username and/or password
> supplied in the processModel section of the config file are invalid.

check the processModel section of either or both your machine.config file
and your web.config file.

--
HTH,

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

"Chris Davoli" <ChrisDavoli@.discussions.microsoft.com> wrote in message
news:3BC3F8E7-735F-40E7-B345-F7C0E36C0D60@.microsoft.com...
>I get the following message:
> Server Application Unavailable
> The web application you are attempting to access on this web server is
> currently unavailable. Please hit the "Refresh" button in your web
> browser
> to retry your request.
> Administrator Note: An error message detailing the cause of this specific
> request failure can be found in the application event log of the web
> server.
> Please review this log entry to discover what caused this error to occur.
> Event log shows me this:
> aspnet_wp.exe could not be launched because the username and/or password
> supplied in the processModel section of the config file are invalid.
> Also get this trying to bring up VS.NET:
> The web server got the following error when attempting to create or open
> the
> web project located at the following URL: 'http://localhost/pp. 'HTTP/1.1
> 500
> Internal Server Error'.
> What do I need to do to fix this?
> Thanks
> Chris
>
> --
> Chris Davoli