Hi All,
I'm using application object in Application.Lock(). But some errors are coming.The errors has been given below.

Error E:\...\StateMgmt\ 25 E:\infonet\in\StateMgmt\Default.aspx.cs 24 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'Lock' and no extension method 'Lock' accepting a first argument of type 'System.Web.UI.HtmlControls.HtmlForm' could be found (are you missing a using directive or an assembly reference?) 2


Error E:\...\StateMgmt\ 13 E:\infonet\in\StateMgmt\Default.aspx.cs 25 Cannot apply indexing with [] to an expression of type 'System.Web.UI.HtmlControls.HtmlForm' 3

Error E:\...\StateMgmt\ 25 E:\infonet\in\StateMgmt\Default.aspx.cs 26 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'UnLock' and no extension method 'UnLock' accepting a first argument of type 'System.Web.UI.HtmlControls.HtmlForm' could be found (are you missing a using directive or an assembly reference?) 4

Error E:\...\StateMgmt\ 108 E:\infonet\in\StateMgmt\Default.aspx.cs 27 Cannot apply indexing with [] to an expression of type 'System.Web.UI.HtmlControls.HtmlForm' 5

Can anyone tell me the solution?

Where is Application.Lock() defined at? I have never heard of it. What is it supposed to do? Can you provide some URLs to read about it?

Hi,
the code is in codebehind of a aspx page.
am pasting the code please chk it.

protected void btnSubmit_Click(object sender, System.EventArgs e)
    {
        if(IsValid)
        {
            Application.Lock();
            Application[txtName.Text] = txtValue.Text;
            Application.UnLock();
            lblResult.Text = "The value of <b>" + txtName.Text + "</b> in the Application object is <b>" + Application[txtName.Text].ToString() + "</b>";

        }
    }

Please use code tags when posting code:

[code=c#] ....code here....

[/code]

I see that you're calling it -- but what do you think it does? Where did you get that code from? Without knowing where it is defined, it does no good.

do you mean to say that i have to define the application objet in global.asax page before call it?

No I mean to say "what you're asking makes no sense."

so according to u what should be the way to go?

commented: nonsensical posts -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.