June 2007 - Posts
This is great article for using Ajax.NET PageMethods.
By using PageMethods we can call Server Side Code function directly from the client and get some results returned from Server.
http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx
In many projects i built, i used the OutputCache to improve WebSites performance and scalability. OutputCache is a powerful tool for increasing WebSites performance. When using OutputCache, the IIS saves a new version for the specific requested Page in memory. The next time we request the same Page, the IIS will serve us the rendered Page from memory, there for not process the page again. We can also set some conditions for the cache version like: when to cache it, how, and for how long (Duration).
First, how OutputCache directive looks like. in this case, we set the Duration to 300 (Seconds), witch means 5 minutes (300 / 60), and we set the VaryByParam to *, witch means that IIS will save a version for each requested Page and QueryString Params.
<%@ OutputCache VaryByParam="*" Duration="300" %>
For example, when we request URL like this: http://www.microsoft.co.il , the IIS now saves a version specific for this address, and when we request http://www.microsoft.co.il?catid=432 , the IIS now saves another version for this specific URL with the specific params added to QueryString params. The next time we request one of those URLs, the IIS will serve us the rendered version from memory for the specific requested page and for the requested QueryString params. Therefor the IIS will not process the Page again. Witch means we save a lots of IIS thinking time.
All most in every WebSite i built, i add an OutputCache directive in all most each of the Pages\UserControls, and set the Duration, and the varyBy conditions separately. This becomes a problem when i want to change some conditions or to change the cache Duration in all the WebSite Pages. In this case, i have to go threw the entire Pages/UserControls and change the OutputCache directive separately.
In VS2005, we have the ability to set a global cache Profile in web.config, and call it directly in the OutputCace directive. First, lets set the cache profiles in web.config under system.web section:
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="High" duration="36000" varyByParam="*"/>
<add name="Low" duration="300" varyByParam="catid"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
Now lets see how we call the cache Profile in the OutputCache directive:
<%@ OutputCache CacheProfile="High" %>
Now, when i want to change the Duration or the conditions for my cached pages, i need to change them only in the web.config cache Profiles. Further more, in development environment, i will change the cache Duration to 0, for debugging.
Conclusion - OutputCache is powerful tool to increase performance, and now its even more easy to use.
Smart man once said..." I am cornholio - I need tipy for my bunghole"
The problem: When trying to update one UpdatePanel (up1) control next to another UpdatePanel (up2) control, one influences the other and there both triggered.
The solution: Adding Attribute UpdateMode="Conditional" to the UpdatePanel control that you don’t wish to update when triggering the next UpdateControl. Now they will not trigger each other.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="400" cellpadding="0" border="1" cellspacing="0">
<tr>
<td><asp:TextBox runat="server" ID="tb1" /></td>
</tr>
<tr>
<td><asp:Button runat="server" ID="bt1" Text="Submit" /></td>
</tr>
<tr>
<td>
<asp:Literal runat="server" ID="ltr1" />
<%=DateTime.Now.ToString() %>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table width="400" cellpadding="0" border="1" cellspacing="0">
<tr>
<td><asp:TextBox runat="server" ID="tb2" /></td>
</tr>
<tr>
<td><asp:Button runat="server" ID="bt2" Text="Submit" /></td>
</tr>
<tr>
<td>
<asp:Literal runat="server" ID="ltr2" />
<%=DateTime.Now.ToString() %>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Look at this site... i have only one word, amazing!
This is the way a website should look like..., this guys thought on everything.
I love the user experience when trying to open a menu and the way there organized, The number of features in the menu and the way they expand.
Check it out... http://www.netvibes.com/
SCEPIA.com looking for C# Web Developers...
bool iAmTeamPlayer = true;
while (lookingForJob)
{
if (!iAmTeamPlayer)
break;
else
{
I WHANT TO WORK AT SCEPIA !
}
}
Technical: Experienced C# Web Developer - at least 2 years. Server ans Client side, VS2003/2005, MSSQL, Stored Procedures.
Must have Experinece in DHTML, JS, HTML.
Soooo... think its in u?, Please send your resume: gilad.lavian@gmail.com
http://www.owasp.org/index.php/Top_10_2007
Here u can find the Top 10 Web application vulnerabilities for 2007.
as usual, the most frequent attacks are Cross Site Scripting, an SQL Injections...
I highly recommend to inspect the summery list for the vulnerabilities to learn how to avoid them.
Scroll down for the summery list represents the application vulnerabilities and explaination links for each of the them.
Here is a great way to transform an XML string returned from DB Query to a HTML using DataGrid/List...
The xml represent by the StringReader, witch implements a TextReader that reads from a string.
Then loaded to DataSet (by ds.ReadXML), and finally binds to the DataGrid.
//Supposed this is the text returning from DB...
string xml = "<rows><row id='1'><name>Gilad</name><address>Burla</address>"
+ "<country>Israel</country></row><row id='2'><name>John</name>"
+ "<address>Igaal Alon</address><country>Israel</country></row></rows>";
using (StringReader reader = new StringReader(xml))
{
DataSet ds = new DataSet();
ds.ReadXml(reader);
dgTest.DataSource = ds;
dgTest.DataBind();
} |