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?

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by bshyama24@gmail

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?

Edited by peter_budo: [icode] corrected

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

}
}

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.

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?