Showing posts with label andi. Show all posts
Showing posts with label andi. Show all posts

Thursday, March 29, 2012

Please give me Parameter Examples in ASP.net 2

Please some one help me. I'm trying to learn something very very simple and
I just have to see how it's done. If you're using VS2005 or VWD, please
create this very simple asp.net page for me and just past the whole source
code so I can see how it's done. People keep giving little bitsof code here and there saying try this or this and none of it isworking. Please let me see a completed source code for thissimple asp page.

This is all i want to do.
DB = SQL northwind
Table = Customer
Column = Contact Name
One Textbox = textbox1 with default value of "c"

I just want to see how you can pass a variable to the Select using Like
that contains the value in the textbox1.text. The result will show on a
simple GridView. I know I basically have to do it with parameters and I've
read a lot and tried a lot and can not get it to work. This is the Select
from VS2005. Can someone tell me if this is correct? My peramter name is
@dotnet.itags.org.test. The SQLDataSource is fine.

SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
LIKE '%' + @dotnet.itags.org.test + '%')"

Please please please create this simple aspx and paste the whole source code
so I can see how it's done.

Thanks in advance.

PhilVS2003 I'm afraid, namespace is SampleWebApp. HTML page;

<%@. Page language="c#" Codebehind="NWTest.aspx.cs" AutoEventWireup="false" Inherits="SampleWebApp.NWTest" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>NWTest</title><meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" Content="C#"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></HEAD><body><form id="Form1" method="post" runat="server"><asp:TextBox ID="txtText" Runat="server">c</asp:TextBox><p><asp:DataGrid ID="ResultsGrid" AutoGenerateColumns="True" Runat="server" /></p><p><asp:Button ID="cmdSubmit" Runat="server" Text="Search" /></p></form></body></HTML>

Code-behind;

using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;namespace SampleWebApp{/// <summary>/// Summary description for NWTest./// </summary>public class NWTest : System.Web.UI.Page{protected System.Web.UI.WebControls.Button cmdSubmit;protected System.Web.UI.WebControls.DataGrid ResultsGrid;protected System.Web.UI.WebControls.TextBox txtText;private void Page_Load(object sender, System.EventArgs e){if (Page.IsPostBack){// Define our connection stringstring connection = "server=localhost;database=northwind;uid=sa;pwd=;";// Create a connection objectSqlConnection con = new SqlConnection(connection);// Create a command object for our SELECT, passing the connection objectSqlCommand com = new SqlCommand("SELECT [ContactName] FROM [Customers] WHERE [ContactName] LIKE '%' + @.test + '%'", con);// Creat a parameter to hold the value of @.testSqlParameter p = com.Parameters.Add ("@.test", SqlDbType.VarChar, 50);// Give it a valuep.Value = txtText.Text.Trim();// Open the connectioncon.Open();// Get a DataReader from the commandSqlDataReader r = com.ExecuteReader();// Give the DataReader to the DataGrid as a data sourceResultsGrid.DataSource = r;// Bind the DataGrid, causing it to renderResultsGrid.DataBind();// Close the connectioncon.Close();}}#region Web Form Designer generated codeoverride protected void OnInit(EventArgs e){//// CODEGEN: This call is required by the ASP.NET Web Form Designer.//InitializeComponent();base.OnInit(e);}/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>private void InitializeComponent(){ this.Load += new System.EventHandler(this.Page_Load);}#endregion}}

Thanks, but it didn't work. I'm using VS2005 and the code is giving me all sort of errors.

Can someone out there using VS2005 or VWD please give me this working example. PLLLEEEAAAASSSSEEE and thank you.
Can't you just create a new web page and cut and paste in only the relevant code? I doubt 2.0 is so far different that complete basics no longer work.
There have been some changes to the @.Page directive and <Head> sections in 2005. The "Web Form Designer generated code" doesn't appear in 2005 unless you specify that you don't want partial classes used. I'd do what Aidy suggested and just cut and paste the pertinent sections (the <form> to </form> and page_load event) into a page you've created.

Please give me Parameter Examples in ASP.net 2

Please some one help me. I'm trying to learn something very very simple and
I just have to see how it's done. If you're using VS2005 or VWD, please
create this very simple asp.net page for me and just past the whole source
code so I can see how it's done.
This is all i want to do.
DB = SQL northwind
Table = Customer
Column = Contact Name
One Textbox = textbox1 with default value of "c"
I just want to see how you can pass a variable to the Select using Like
that contains the value in the textbox1.text. The result will show on a
simple GridView. I know I basically have to do it with parameters and I've
read a lot and tried a lot and can not get it to work. This is the Select
from VS2005. Can someone tell me if this is correct? My peramter name is
@dotnet.itags.org.test. The SQLDataSource is fine.
SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
LIKE '%' + @dotnet.itags.org.test + '%')"
Please please please create this simple aspx and paste the whole source code
so I can see how it's done.
Thanks in advance.
Philthe following will work so long as you place it within the
<asp:SQLDataSource> tags.
<SelectParameters>
<asp:ControlParameter Name="test" ControlID="textbox1"
PropertyName="Text" />
</SelectParameters>
"Phillip Vong" wrote:

> Please some one help me. I'm trying to learn something very very simple a
nd
> I just have to see how it's done. If you're using VS2005 or VWD, please
> create this very simple asp.net page for me and just past the whole source
> code so I can see how it's done.
> This is all i want to do.
> DB = SQL northwind
> Table = Customer
> Column = Contact Name
> One Textbox = textbox1 with default value of "c"
> I just want to see how you can pass a variable to the Select using Like
> that contains the value in the textbox1.text. The result will show on a
> simple GridView. I know I basically have to do it with parameters and I'v
e
> read a lot and tried a lot and can not get it to work. This is the Select
> from VS2005. Can someone tell me if this is correct? My peramter name is
> @.test. The SQLDataSource is fine.
> SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
> LIKE '%' + @.test + '%')"
> Please please please create this simple aspx and paste the whole source co
de
> so I can see how it's done.
> Thanks in advance.
> Phil
>
>
>
underprocessable

Please give me Parameter Examples in ASP.net 2

Please some one help me. I'm trying to learn something very very simple and
I just have to see how it's done. If you're using VS2005 or VWD, please
create this very simple asp.net page for me and just past the whole source
code so I can see how it's done.

This is all i want to do.
DB = SQL northwind
Table = Customer
Column = Contact Name
One Textbox = textbox1 with default value of "c"

I just want to see how you can pass a variable to the Select using Like
that contains the value in the textbox1.text. The result will show on a
simple GridView. I know I basically have to do it with parameters and I've
read a lot and tried a lot and can not get it to work. This is the Select
from VS2005. Can someone tell me if this is correct? My peramter name is
@dotnet.itags.org.test. The SQLDataSource is fine.

SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
LIKE '%' + @dotnet.itags.org.test + '%')"

Please please please create this simple aspx and paste the whole source code
so I can see how it's done.

Thanks in advance.

Philthe following will work so long as you place it within the
<asp:SQLDataSource> tags.

<SelectParameters>
<asp:ControlParameter Name="test" ControlID="textbox1"
PropertyName="Text" />
</SelectParameters
"Phillip Vong" wrote:

> Please some one help me. I'm trying to learn something very very simple and
> I just have to see how it's done. If you're using VS2005 or VWD, please
> create this very simple asp.net page for me and just past the whole source
> code so I can see how it's done.
> This is all i want to do.
> DB = SQL northwind
> Table = Customer
> Column = Contact Name
> One Textbox = textbox1 with default value of "c"
> I just want to see how you can pass a variable to the Select using Like
> that contains the value in the textbox1.text. The result will show on a
> simple GridView. I know I basically have to do it with parameters and I've
> read a lot and tried a lot and can not get it to work. This is the Select
> from VS2005. Can someone tell me if this is correct? My peramter name is
> @.test. The SQLDataSource is fine.
> SelectCommand="SELECT [ContactName] FROM [Customers] WHERE ([ContactName]
> LIKE '%' + @.test + '%')"
> Please please please create this simple aspx and paste the whole source code
> so I can see how it's done.
> Thanks in advance.
> Phil
>
>

Saturday, March 24, 2012

Please help explain what an "application instance" really is in terms of static data

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application and
I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application life
cycle and for multiple page loads for the same or different page under a
root application.

What I don't understand and need to know is whether that static data would
be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my application
has its own set of static data that is potentially shared by multiple users.

Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of an
assembly or is it multiple loads of an assembly each of which can be used by
multiple users/threads?

As an analogy, let's say I write a multi threaded desktop app and allowed
multiple threads to use an object called X that was created by the main
thread. If that object X had static data then all threads in one process
that loaded my application would share that data in X even if each thread
had its own instance of X. But if I loaded 2 copies of my desktop
application (like running 2 copies of notepad.exe), each process would have
only one instance of object X static data no matter how many isntances of X
and each set of X static data would be shared by multiple threads in that
process but the staic data would not be shared between processes.

My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static data?
One for each asp.net "application instance" or whether instance is just
referring to the fact that multiple users can be sharing the same static
data in the module that was loaded for the benefit of multiple users which I
believe I read are sequenced thru one at a time. Or do I really have to
worry about some users sharing one set of static data for one loading of my
application and another set of users sharing another set of static data
because my asp.net application was loaded again for them?

Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the multiple
copies of the static data.

So to summarize:

1. Can/must a C# lock be used for static data for ALL users on one machine -
depends if users are sequenced thru the application. Or is this totally
insufficient to protect a shared resource under asp.net?

2. Or rather must I somehow externally [like named semaphores] synchronize
across multiple application instances to protect that truly only one user at
a time on a given machine can modify a resource similar to what I would need
to do if I had multiple desktop processes running on one machine that had to
sequence use of a resource one at a time?

Whew...thanks!

Dave"static" means there is only one copy of the data. This is available to all
users of an application. If one user changes it, it is changed for all users.
You need to study the difference between the ASP.NET Application object vs.
what is "static" - they have similar features but are not the same thing. An
Application is a running instance of your web site in IIS, to put it in
simplest terms.

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
"Dave" wrote:

Quote:

Originally Posted by

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application and
I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application life
cycle and for multiple page loads for the same or different page under a
root application.
>
What I don't understand and need to know is whether that static data would
be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my application
has its own set of static data that is potentially shared by multiple users.
>
Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of an
assembly or is it multiple loads of an assembly each of which can be used by
multiple users/threads?
>
As an analogy, let's say I write a multi threaded desktop app and allowed
multiple threads to use an object called X that was created by the main
thread. If that object X had static data then all threads in one process
that loaded my application would share that data in X even if each thread
had its own instance of X. But if I loaded 2 copies of my desktop
application (like running 2 copies of notepad.exe), each process would have
only one instance of object X static data no matter how many isntances of X
and each set of X static data would be shared by multiple threads in that
process but the staic data would not be shared between processes.
>
My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static data?
One for each asp.net "application instance" or whether instance is just
referring to the fact that multiple users can be sharing the same static
data in the module that was loaded for the benefit of multiple users which I
believe I read are sequenced thru one at a time. Or do I really have to
worry about some users sharing one set of static data for one loading of my
application and another set of users sharing another set of static data
because my asp.net application was loaded again for them?
>
Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the multiple
copies of the static data.
>
So to summarize:
>
1. Can/must a C# lock be used for static data for ALL users on one machine -
depends if users are sequenced thru the application. Or is this totally
insufficient to protect a shared resource under asp.net?
>
>
2. Or rather must I somehow externally [like named semaphores] synchronize
across multiple application instances to protect that truly only one user at
a time on a given machine can modify a resource similar to what I would need
to do if I had multiple desktop processes running on one machine that had to
sequence use of a resource one at a time?
>
Whew...thanks!
>
Dave
>
>


static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).

an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).

with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.

when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.

but when a website recycle happens (code changed, too much memory,etc),
a new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use
the new appdomain. they do not see each others statics.

this last issue becomes important if you are referencing a unmanaged
dll. the unmanaged dll is actually loaded into the worker process, so
any statics in it are shared across both appdomains and in fact all
other websites using the same pool.

just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool,
as each request gets its on unique instance. (this is for performace
reasons beyond the scope of this over simplified explanation). this is
why there is are begin and end events, hooking to create/dispose would
happen too often.

your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.

this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.

note: the application cache has serialized access to the object, but
does not sync methods/property accesses. the object should be thread
safe, or again you need to use locks.

-- bruce (sqlwork.com)

Dave wrote:

Quote:

Originally Posted by

I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application
and I realize that static data is shared amongst child apps of an IIS
application and can be used by multiple users during the application
life cycle and for multiple page loads for the same or different page
under a root application.
>
What I don't understand and need to know is whether that static data
would be shared by ALL users of my application on a single server if my
application was loaded at all or whether it is possible to have my
application loaded multiple times such that each loading of my
application has its own set of static data that is potentially shared by
multiple users.
>
Exactly what is an asp.net "application instance" in terms of windows
process, thread and object terminology which I understand well - is it a
user's sequenced use of the loaded assembly, concurrent thread usage of
an assembly or is it multiple loads of an assembly each of which can be
used by multiple users/threads?
>
As an analogy, let's say I write a multi threaded desktop app and
allowed multiple threads to use an object called X that was created by
the main thread. If that object X had static data then all threads in
one process that loaded my application would share that data in X even
if each thread had its own instance of X. But if I loaded 2 copies of my
desktop application (like running 2 copies of notepad.exe), each process
would have only one instance of object X static data no matter how many
isntances of X and each set of X static data would be shared by multiple
threads in that process but the staic data would not be shared between
processes.
>
My concern is what scope I must lock at for all users of my asp.net
application on one machine. Can there be multiple copies of my static
data? One for each asp.net "application instance" or whether instance is
just referring to the fact that multiple users can be sharing the same
static data in the module that was loaded for the benefit of multiple
users which I believe I read are sequenced thru one at a time. Or do I
really have to worry about some users sharing one set of static data for
one loading of my application and another set of users sharing another
set of static data because my asp.net application was loaded again for
them?
>
Hope I made myself clear. If I can have multiple sets of users each with
their own shared static data then I need to somehow lock across the
multiple copies of the static data.
>
So to summarize:
>
1. Can/must a C# lock be used for static data for ALL users on one
machine - depends if users are sequenced thru the application. Or is
this totally insufficient to protect a shared resource under asp.net?
>
>
2. Or rather must I somehow externally [like named semaphores]
synchronize across multiple application instances to protect that truly
only one user at a time on a given machine can modify a resource similar
to what I would need to do if I had multiple desktop processes running
on one machine that had to sequence use of a resource one at a time?
>
Whew...thanks!
>
Dave
>


Thanks so much Bruce. This clears up several issues understanding more what
happens. I forgot since this is managed code that the framework can do
things within a windows process that unmanaged code cannot such as
isolation. If you could bear with me I need clarification on a few points:

1. Sounds like in the normal case, ALL users of a website application shares
static data since there the code is loaded into only one appdomain. But
there could be 2 or more appdomains running the code in the case of recycle,
configuring multiple pools or I'm guessing in the case of a web garden in
which case there would be multiple instances of my static data loaded with
some users assigned to one and others to another. Did I understand that
right?

2. I understand the unmanaged dll situation and is not a concern for me.

3. I'm confused on your description of the Application object as to each
user getting their own instance. I thought that object was shared by all
users of the application even if there could possibly be multiple appdomains
running that application as in the cases you mentioned. 'Course they do say
"Application Instance" which I think is at the root of my confusion. What is
meant by "instance" in this case?

4. If Application_Start runs when the application is loaded for the first
user, does it not have to finish before any other user enters the code? If
so then why would it matter if any sort of locking ws used or not for
readonly or readwrite resoruces? I probably misunderstood. Am unclear if
asp.net code has to be rentrant as I read once that users are serialized
thru an application but have my doubts as that would not scale very well.

5. Am also thinking that using "lock (static myobject)" would only work
within a single appdomain and that if in fact multiple appdomains had my
code loaded it would not serialize access amongst appdomains but only for
threads within an appdomain if for no other reason than that they had their
own copy of "myobject". Did you mean to say that somehow the C# lock would
work between appdomains or did I misunderstand?

6. Given, let's say, the possibility of multiple appdomains running the same
code wanting to update a file shared by all the child applications in an IIS
application, what would you recommend for synchronization so they don't step
on each other? A named semaphore or named mutex?

Thanks again,
Dave

"bruce barker" <nospam@.nospam.comwrote in message
news:OBMF2aAKIHA.4592@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).
>
an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).
>
with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.
>
when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.
>
but when a website recycle happens (code changed, too much memory,etc), a
new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use the
new appdomain. they do not see each others statics.
>
this last issue becomes important if you are referencing a unmanaged dll.
the unmanaged dll is actually loaded into the worker process, so any
statics in it are shared across both appdomains and in fact all other
websites using the same pool.
>
just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool, as
each request gets its on unique instance. (this is for performace reasons
beyond the scope of this over simplified explanation). this is why there
is are begin and end events, hooking to create/dispose would happen too
often.
>
your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.
>
>
this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.
>
note: the application cache has serialized access to the object, but does
not sync methods/property accesses. the object should be thread safe, or
again you need to use locks.
>
>
-- bruce (sqlwork.com)
>
>
Dave wrote:

Quote:

Originally Posted by

>I have a global.asax file with Application_Start defined and create some
>static data there and in another module used in the asp.net application
>and I realize that static data is shared amongst child apps of an IIS
>application and can be used by multiple users during the application life
>cycle and for multiple page loads for the same or different page under a
>root application.
>>
>What I don't understand and need to know is whether that static data
>would be shared by ALL users of my application on a single server if my
>application was loaded at all or whether it is possible to have my
>application loaded multiple times such that each loading of my
>application has its own set of static data that is potentially shared by
>multiple users.
>>
>Exactly what is an asp.net "application instance" in terms of windows
>process, thread and object terminology which I understand well - is it a
>user's sequenced use of the loaded assembly, concurrent thread usage of
>an assembly or is it multiple loads of an assembly each of which can be
>used by multiple users/threads?
>>
>As an analogy, let's say I write a multi threaded desktop app and allowed
>multiple threads to use an object called X that was created by the main
>thread. If that object X had static data then all threads in one process
>that loaded my application would share that data in X even if each thread
>had its own instance of X. But if I loaded 2 copies of my desktop
>application (like running 2 copies of notepad.exe), each process would
>have only one instance of object X static data no matter how many
>isntances of X and each set of X static data would be shared by multiple
>threads in that process but the staic data would not be shared between
>processes.
>>
>My concern is what scope I must lock at for all users of my asp.net
>application on one machine. Can there be multiple copies of my static
>data? One for each asp.net "application instance" or whether instance is
>just referring to the fact that multiple users can be sharing the same
>static data in the module that was loaded for the benefit of multiple
>users which I believe I read are sequenced thru one at a time. Or do I
>really have to worry about some users sharing one set of static data for
>one loading of my application and another set of users sharing another
>set of static data because my asp.net application was loaded again for
>them?
>>
>Hope I made myself clear. If I can have multiple sets of users each with
>their own shared static data then I need to somehow lock across the
>multiple copies of the static data.
>>
>So to summarize:
>>
>1. Can/must a C# lock be used for static data for ALL users on one
>machine - depends if users are sequenced thru the application. Or is this
>totally insufficient to protect a shared resource under asp.net?
>>
>>
>2. Or rather must I somehow externally [like named semaphores]
>synchronize across multiple application instances to protect that truly
>only one user at a time on a given machine can modify a resource similar
>to what I would need to do if I had multiple desktop processes running on
>one machine that had to sequence use of a resource one at a time?
>>
>Whew...thanks!
>>
>Dave
>>


Bruce, would dearly love to hear your view on my response to this message.
This one was so helpful. THe doc is not very clear on these sort of issues
or on reentrancy either. Thanks, Dave

"bruce barker" <nospam@.nospam.comwrote in message
news:OBMF2aAKIHA.4592@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

static data is visible to all threads in the same ApplicationDomain. the
appdomain represents an instance of the clr vm. each app domain has its
own memory, stack, code and heap (gc).
>
an actually program can host more have more than one appdomain, and
appdomain can talk to each other, but only thru remoting (even if in the
same nt process).
>
with asp.net there is a worker process per application pool. you can
config asp.net to use one pool (process) or more.
>
when an asp.net application is defined in IIS (its bound to a vdir), you
assign it to the pool. when the asp.net application (i'll call website
because there are too many application references) is started, an
appdomain is created and its loaded into it. normally there is only one
appdomain per website. so statics are shared between all users (threads)
of that website.
>
but when a website recycle happens (code changed, too much memory,etc), a
new appdomain is started, and the old one is shut down. if there any
request using the old appdomain, they complete while new requests use the
new appdomain. they do not see each others statics.
>
this last issue becomes important if you are referencing a unmanaged dll.
the unmanaged dll is actually loaded into the worker process, so any
statics in it are shared across both appdomains and in fact all other
websites using the same pool.
>
just to confuse things a little, there is a Application object, which
global.asx represents. the instances of these are maintained in a pool, as
each request gets its on unique instance. (this is for performace reasons
beyond the scope of this over simplified explanation). this is why there
is are begin and end events, hooking to create/dispose would happen too
often.
>
your application statics may or may not need locking. application begin
fires and completes before any other request has access to the
application. so read only can safely be loaded during this event without
locks. if it a read/write resource and does not sync access on its own,
then you need to use locks. c# has a lock statement you can use.
>
>
this is different than session, which has serialized access, as only one
request is processed at a time that uses the same session. this allows
concurrent request, just not to the same session data. this would be too
limiting for application access, so you need locks.
>
note: the application cache has serialized access to the object, but does
not sync methods/property accesses. the object should be thread safe, or
again you need to use locks.
>
>
-- bruce (sqlwork.com)
>
>
Dave wrote:

Quote:

Originally Posted by

>I have a global.asax file with Application_Start defined and create some
>static data there and in another module used in the asp.net application
>and I realize that static data is shared amongst child apps of an IIS
>application and can be used by multiple users during the application life
>cycle and for multiple page loads for the same or different page under a
>root application.
>>
>What I don't understand and need to know is whether that static data
>would be shared by ALL users of my application on a single server if my
>application was loaded at all or whether it is possible to have my
>application loaded multiple times such that each loading of my
>application has its own set of static data that is potentially shared by
>multiple users.
>>
>Exactly what is an asp.net "application instance" in terms of windows
>process, thread and object terminology which I understand well - is it a
>user's sequenced use of the loaded assembly, concurrent thread usage of
>an assembly or is it multiple loads of an assembly each of which can be
>used by multiple users/threads?
>>
>As an analogy, let's say I write a multi threaded desktop app and allowed
>multiple threads to use an object called X that was created by the main
>thread. If that object X had static data then all threads in one process
>that loaded my application would share that data in X even if each thread
>had its own instance of X. But if I loaded 2 copies of my desktop
>application (like running 2 copies of notepad.exe), each process would
>have only one instance of object X static data no matter how many
>isntances of X and each set of X static data would be shared by multiple
>threads in that process but the staic data would not be shared between
>processes.
>>
>My concern is what scope I must lock at for all users of my asp.net
>application on one machine. Can there be multiple copies of my static
>data? One for each asp.net "application instance" or whether instance is
>just referring to the fact that multiple users can be sharing the same
>static data in the module that was loaded for the benefit of multiple
>users which I believe I read are sequenced thru one at a time. Or do I
>really have to worry about some users sharing one set of static data for
>one loading of my application and another set of users sharing another
>set of static data because my asp.net application was loaded again for
>them?
>>
>Hope I made myself clear. If I can have multiple sets of users each with
>their own shared static data then I need to somehow lock across the
>multiple copies of the static data.
>>
>So to summarize:
>>
>1. Can/must a C# lock be used for static data for ALL users on one
>machine - depends if users are sequenced thru the application. Or is this
>totally insufficient to protect a shared resource under asp.net?
>>
>>
>2. Or rather must I somehow externally [like named semaphores]
>synchronize across multiple application instances to protect that truly
>only one user at a time on a given machine can modify a resource similar
>to what I would need to do if I had multiple desktop processes running on
>one machine that had to sequence use of a resource one at a time?
>>
>Whew...thanks!
>>
>Dave
>>

Wednesday, March 21, 2012

Please help in understanding error

Hi,

I have just deployed my private assembly in the bin directory of my ISP and
I am getting the following error. I am pretty sure it is able to find my
assemblyPLEASE tell me how can I find which dependencies are not being
found( is there a way to trace the dependencies which are not found).
I Just have ftp access to my isp server.

Thanks you in advance,
Peace,
Raj.

Server Error in '/' Application.
-----------------------
--

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: File or assembly name dotnetOTLicLib, or one of its
dependencies, was not found.

Source Error:

Line 256: <add assembly="System.EnterpriseServices,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257: <add assembly="System.Web.Mobile,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258: <add assembly="*"/>
Line 259: </assemblies>
Line 260:

Source File:
c:\winnt\microsoft.net\framework\v1.1.4322\Config\ machine.config Line:
258

Assembly Load Trace: The following information can be helpful to determine
why the assembly 'dotnetOTLicLib' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = dotnetOTLicLib
(Partial)
LOG: Appbase = file:///d:/users/lexro/html
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: dotnetOTLicLib
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/51973f4f/48d9daf8/dotnetOTLicLib.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework
/v1.1.4322/Temporary ASP.NET
Files/root/51973f4f/48d9daf8/dotnetOTLicLib/dotnetOTLicLib.DLL.
LOG: Attempting download of new URL
file:///d:/users/lexro/html/bin/dotnetOTLicLib.DLL.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: dotnetOTLicLib, Version=1.0.1738.21203,
Culture=neutral, PublicKeyToken=null

-----------------------
--
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032its a file your isp is requiring. probably they do not allow private bins.
check you isp agreement on deploying .net assemblies

-- bruce (sqlwork.com)

"news" <asdfa@.sadf.com> wrote in message
news:39ydnU19ydol4vzcRVn-hg@.rogers.com...
> Hi,
> I have just deployed my private assembly in the bin directory of my ISP
and
> I am getting the following error. I am pretty sure it is able to find my
> assemblyPLEASE tell me how can I find which dependencies are not being
> found( is there a way to trace the dependencies which are not found).
> I Just have ftp access to my isp server.
> Thanks you in advance,
> Peace,
> Raj.
>
> Server Error in '/' Application.
> -----------------------
--
> --
> Configuration Error
> Description: An error occurred during the processing of a configuration
file
> required to service this request. Please review the specific error details
> below and modify your configuration file appropriately.
> Parser Error Message: File or assembly name dotnetOTLicLib, or one of its
> dependencies, was not found.
> Source Error:
> Line 256: <add assembly="System.EnterpriseServices,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> Line 257: <add assembly="System.Web.Mobile,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> Line 258: <add assembly="*"/>
> Line 259: </assemblies>
> Line 260:
> Source File:
> c:\winnt\microsoft.net\framework\v1.1.4322\Config\ machine.config Line:
> 258
> Assembly Load Trace: The following information can be helpful to determine
> why the assembly 'dotnetOTLicLib' could not be loaded.
> === Pre-bind state information ===
> LOG: DisplayName = dotnetOTLicLib
> (Partial)
> LOG: Appbase = file:///d:/users/lexro/html
> LOG: Initial PrivatePath = bin
> Calling assembly : (Unknown).
> ===
> LOG: Policy not being applied to reference at this time (private, custom,
> partial, or location-based assembly bind).
> LOG: Post-policy reference: dotnetOTLicLib
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/root/51973f4f/48d9daf8/dotnetOTLicLib.DLL.
> LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework
> /v1.1.4322/Temporary ASP.NET
> Files/root/51973f4f/48d9daf8/dotnetOTLicLib/dotnetOTLicLib.DLL.
> LOG: Attempting download of new URL
> file:///d:/users/lexro/html/bin/dotnetOTLicLib.DLL.
> LOG: Policy not being applied to reference at this time (private, custom,
> partial, or location-based assembly bind).
> LOG: Post-policy reference: dotnetOTLicLib, Version=1.0.1738.21203,
> Culture=neutral, PublicKeyToken=null
>
> -----------------------
--
> --
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET
> Version:1.1.4322.2032

Please help in understanding error

Hi,
I have just deployed my private assembly in the bin directory of my ISP and
I am getting the following error. I am pretty sure it is able to find my
assemblyPLEASE tell me how can I find which dependencies are not being
found( is there a way to trace the dependencies which are not found).
I Just have ftp access to my isp server.
Thanks you in advance,
Peace,
Raj.
Server Error in '/' Application.
----
--
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: File or assembly name dotnetOTLicLib, or one of its
dependencies, was not found.
Source Error:
Line 256: <add assembly="System.EnterpriseServices,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257: <add assembly="System.Web.Mobile,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258: <add assembly="*"/>
Line 259: </assemblies>
Line 260:
Source File:
c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config Line:
258
Assembly Load Trace: The following information can be helpful to determine
why the assembly 'dotnetOTLicLib' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = dotnetOTLicLib
(Partial)
LOG: Appbase = file:///d:/users/lexro/html
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: dotnetOTLicLib
LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/51973f4f/48d9daf8/dotnetOTLicLib.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework
/v1.1.4322/Temporary ASP.NET
Files/root/51973f4f/48d9daf8/dotnetOTLicLib/dotnetOTLicLib.DLL.
LOG: Attempting download of new URL
file:///d:/users/lexro/html/bin/dotnetOTLicLib.DLL.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: dotnetOTLicLib, Version=1.0.1738.21203,
Culture=neutral, PublicKeyToken=null
----
--
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032its a file your isp is requiring. probably they do not allow private bins.
check you isp agreement on deploying .net assemblies
-- bruce (sqlwork.com)
"news" <asdfa@.f.com> wrote in message
news:39ydnU19ydol4vzcRVn-hg@.rogers.com...
> Hi,
> I have just deployed my private assembly in the bin directory of my ISP
and
> I am getting the following error. I am pretty sure it is able to find my
> assemblyPLEASE tell me how can I find which dependencies are not being
> found( is there a way to trace the dependencies which are not found).
> I Just have ftp access to my isp server.
> Thanks you in advance,
> Peace,
> Raj.
>
> Server Error in '/' Application.
> ----
--
> --
> Configuration Error
> Description: An error occurred during the processing of a configuration
file
> required to service this request. Please review the specific error details
> below and modify your configuration file appropriately.
> Parser Error Message: File or assembly name dotnetOTLicLib, or one of its
> dependencies, was not found.
> Source Error:
> Line 256: <add assembly="System.EnterpriseServices,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> Line 257: <add assembly="System.Web.Mobile,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
> Line 258: <add assembly="*"/>
> Line 259: </assemblies>
> Line 260:
> Source File:
> c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config Line:
> 258
> Assembly Load Trace: The following information can be helpful to determine
> why the assembly 'dotnetOTLicLib' could not be loaded.
> === Pre-bind state information ===
> LOG: DisplayName = dotnetOTLicLib
> (Partial)
> LOG: Appbase = file:///d:/users/lexro/html
> LOG: Initial PrivatePath = bin
> Calling assembly : (Unknown).
> ===
> LOG: Policy not being applied to reference at this time (private, custom,
> partial, or location-based assembly bind).
> LOG: Post-policy reference: dotnetOTLicLib
> LOG: Attempting download of new URL
> file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> Files/root/51973f4f/48d9daf8/dotnetOTLicLib.DLL.
> LOG: Attempting download of new URL
file:///C:/WINNT/Microsoft.NET/Framework
> /v1.1.4322/Temporary ASP.NET
> Files/root/51973f4f/48d9daf8/dotnetOTLicLib/dotnetOTLicLib.DLL.
> LOG: Attempting download of new URL
> file:///d:/users/lexro/html/bin/dotnetOTLicLib.DLL.
> LOG: Policy not being applied to reference at this time (private, custom,
> partial, or location-based assembly bind).
> LOG: Post-policy reference: dotnetOTLicLib, Version=1.0.1738.21203,
> Culture=neutral, PublicKeyToken=null
>
> ----
--
> --
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET
> Version:1.1.4322.2032
>