Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Monday, March 26, 2012

Performance tuning ASP.NET applications

I have an ASP.NET application where one of the pages has a Save button to allow the user to save their work. So I have a client running the application in Internet Explorer, a separate IIS server running IIS version 6 and a separate SQL Server 2000 server where the data is saved in a database.
Some users are experiencing major performance issues during the save process. I'm looking for any pointers to articles on the web which can help me analyze/determine where the bottlenecks are in the entire process, i.e. is it a client problem, IIS problem or SQL Server problem.
Any help on how to do this would be greatly appreciated!
Thanks!!

Here's a few online resources related to ASP.NET performance:
ASP.NET Performance Overview
Improving ASP.NET Performance
ASP.NET Performance
Getting Started - Enhancing Web Site Performance with Caching
Optimizing Performance in ASP.NET
Developing High-Performance ASP.NET Applications
Hope these links help.

-- Erik Reitan

ASP.NET User Education
This posting is provided "AS IS" with no warranties, and confers no rights.




Om Sri Sai Ram

Performance :
http://msdn.microsoft.com/practices/compcat/default.aspx?pull=/library/en-us/dnpag/html/scalenet.asp

Caching:
http://msdn.microsoft.com/practices/compcat/default.aspx?pull=/library/en-us/dnbda/html/cachingarch.asp
Thanks,
Ram

Performing a download along with another action

I have a webform that contains a button which I want to do three things:

1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted

I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:

Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()

If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options

1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download

in all cases you refresh the page and then download the text file.

-- bruce (sqlwork.com)

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
Nathan,

Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.

It is the HTML tag <Input type=file
Cor

Performing a download along with another action

I have a webform that contains a button which I want to do three things:
1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted
I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:
Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()
If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options
1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download
in all cases you refresh the page and then download the text file.
-- bruce (sqlwork.com)
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
Nathan,
Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.
It is the HTML tag <Input type=file>
Cor

perhaps a simple question

Hi,

i have a problem.

I have a textbox and a button and a link in my application. When the user clicks the button, the text of the textbox is inserted in my table northwind.
After this is done succesful i want to display a messagebox. After searching in the groups i did this.

Button1_Click(......)
{
--entry in northwind--

string alertscript= "<script language= JavaScript>alert('Succefull inserted');</script>";
if(!IsClientScriptBlockRegistered("alert"))
{
this.RegisterClientScriptBlock("alert", alertscript);
}
}

It works good. But when i click now on the link to another page and then after that click the backbutton in the IE6 to my first page, then the messageBox pops up again. I don`t know why this is done. Is the script still registered ? Please help me? I need to stop this.

Thankswhen you hit your back button, your going back to a cached copy of the page which still has the script in it.

personally, i wouldnt use an alert. Id put a Label/Literal control on the page and then upon successfully inserting a db record, you can set the Text of that control and make it visible.

When the user hits their back button, they still see the old message, but it's not in the way...

permanently Removing a node from a treeview?

hi all

i have managed to remove a node from a treeview by pressing a button, however it doesnt remove it from the database and when i re-run the program the node is still there. Can anyone please help me?

Granto

During your deletion of the node, you'll need to run a delete statement against the table as well. Then refresh your datatable, dataset, or whatever you are using and rebind to your treeview. Should work fine.


Hi,

This problem which you have posted at:http://forums.asp.net/t/1191381.aspx

If the answers in above thread have helped you out, please mark this post as Resoved. If not, don't hesitate to let me know.

However, I provide some suggestions here. Before you remove the node, you should delete the datain database first. Because only remove nodes won't delete the datain database. You can follow the below codes.protected void RemoveNodeButton_Click(object sender, EventArgs e) { TreeNode nd=TreeView1.SelectedNode;if (nd.Parent ==null) {//you should find which are the children node of it. DeleteNode(nd); TreeView1.Nodes.Remove(nd);//which is parent node }else {//delete the data in database by "nd.Text", such as: delete from test where t1='"+nd.Text+"'" TreeView1.SelectedNode.Parent.ChildNodes.Remove(nd);//which is child node } }//delete the every child of the node.protected void DeleteNode(TreeNode nd) {if (nd.ChildNodes.Count == 0)// It is the deepest node. {//Delete the data of child node in database by "nd.Text", such as: delete from test where t1='"+nd.Text+"'"return; } TreeNodeCollection nds = nd.ChildNodes;foreach (TreeNode ein nds) { DeleteNode(e); }//Delete the data of parent node in database by "nd.Text", if you need to delete the data about parent node. Such as: delete from test where t1='"+nd.Text+"'"return; }

Hope this can help you.


cheers for the feedback, could you give an example with code i would need to use?

Granto