<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Gaurav Srivastava&#039;s Blog</title>
	<atom:link href="http://gauravsrivastava.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gauravsrivastava.wordpress.com</link>
	<description>Following Technologies</description>
	<lastBuildDate>Mon, 17 Aug 2009 07:44:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gauravsrivastava.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Gaurav Srivastava&#039;s Blog</title>
		<link>http://gauravsrivastava.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gauravsrivastava.wordpress.com/osd.xml" title="Gaurav Srivastava&#039;s Blog" />
	<atom:link rel='hub' href='http://gauravsrivastava.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Server.Transfer vs. Response.Redirect</title>
		<link>http://gauravsrivastava.wordpress.com/2009/08/17/server-transfer-vs-response-redirect/</link>
		<comments>http://gauravsrivastava.wordpress.com/2009/08/17/server-transfer-vs-response-redirect/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 07:30:49 +0000</pubDate>
		<dc:creator>Gaurav Srivastava</dc:creator>
				<category><![CDATA[Web Development using MS Visual Studio]]></category>

		<guid isPermaLink="false">http://gauravsrivastava.wordpress.com/?p=29</guid>
		<description><![CDATA[A common misconception is the difference between Server.Transfer and Response.Redirect in ASP.NET applications. Redirect and Transfer both cause a new page to be processed, but the interaction between the client (web browser) and server (ASP.Net) is different in each situation. Redirect: A redirect is just a suggestion – it’s like saying to the client “Hey, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=29&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="preLoadLayer0" style="position:absolute;z-index:4000;top:-32px;left:-18px;display:none;"><a id="KonaLink0" style="text-decoration:underline!important;position:static;" href="http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=15#" target="undefined"><img style="border:0 none;" src="http://kona.kontera.com/javascript/lib/imgs/grey_loader.gif" alt="" /></a></div>
<p>A common misconception is the difference between Server.Transfer and Response.Redirect in ASP.NET applications. Redirect and Transfer both cause a new page to be processed, but the interaction between the client (web browser) and server (ASP.Net) is different in each situation.</p>
<p><strong><span style="color:#339966;">Redirect:</span></strong></p>
<p>A redirect is just a suggestion – it’s like saying to the client “Hey, you might want to look at this”. All you tell the client is the new URL to look at, and if they comply, they do a second request for the new URL.</p>
<p>If you want to pass state from the source page to the new page, you have to pass it either on the URL (such as a <a id="KonaLink1" style="text-decoration:underline!important;position:static;" href="http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=15#" target="undefined"> </a>database key, or message string), or you can store it in the Session object (caveat: there may be more than one browser window, and they’ll all use the same session object).</p>
<p>e.g. Redirect to the new.aspx page, passing an ID on the query string. &#8220;true&#8221; stops processing the current page:</p>
<p><span style="color:#ff0000;"> Context.Items["Message"] = &#8220;Response.Redirect(&#8220;new.aspx?id=34&#8243;, true);</span></p>
<p><strong><span style="color:#339966;">Transfer:</span></strong></p>
<p>A transfer happens without the client knowing – it’s the equivalent of a client requesting one page, but being given another. As far as the client knows, they are still visiting the original URL.</p>
<p>Sharing state between pages is much easier using Server.Transfer – you can put values into the Context.Items dictionary, which is similar to Session and Application, except that it lasts only for the current request. (search for HttpContext in MSDN). The page receiving postback can process data, store values in the Context, and then Transfer to a page that uses the values.</p>
<p>e.g. Store a message in the context dictionary, and transfer to the default.aspx page (which can then display the message):</p>
<p><span style="color:#ff0000;"> Context.Items["Message"] = &#8220;Your password was changed successfully&#8221;;</span></p>
<p><span style="color:#ff0000;">Server.Transfer(&#8220;default.aspx&#8221;);</span></p>
<p><span style="color:#339966;"><strong>Caveats:</strong></span></p>
<ul>
<li> Response.Redirect is more user-friendly, as the site visitor can bookmark the  			page that they are redirected to.</li>
<li> Transferred pages appear to the client as a different url than they really are.  			This means that things like relative links / image paths may not work if you  			transfer to a page from a different directory.</li>
<li> Server.Transfer has an optional parameter to pass the form data to the new  		page.</li>
<li> Since the release version, this no longer works, because the Viewstate now has  			more security<a id="KonaLink2" style="text-decoration:underline!important;position:static;" href="http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=15#" target="undefined"> </a> by default (The EnableViewStateMac defaults to true), so the new  			page isn’t able to access the form data. You can still access the values of the  			original page in the new page, by requesting the original handler:<span style="color:#ff0000;"></span></li>
</ul>
<p><span style="color:#ff0000;">Page originalPage = (Page)Context.Handler;</span></p>
<p><span style="color:#ff0000;">TextBox textBox1 = (TextBox)originalPage.FindControl(&#8220;textBox1&#8243;);</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gauravsrivastava.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gauravsrivastava.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gauravsrivastava.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=29&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gauravsrivastava.wordpress.com/2009/08/17/server-transfer-vs-response-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a760867d1b124308f778d4e3755cf73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaurav</media:title>
		</media:content>

		<media:content url="http://kona.kontera.com/javascript/lib/imgs/grey_loader.gif" medium="image" />
	</item>
		<item>
		<title>Using the window.open method</title>
		<link>http://gauravsrivastava.wordpress.com/2009/06/29/using-the-window-open-method/</link>
		<comments>http://gauravsrivastava.wordpress.com/2009/06/29/using-the-window-open-method/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 11:41:00 +0000</pubDate>
		<dc:creator>Gaurav Srivastava</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://gauravsrivastava.wordpress.com/?p=24</guid>
		<description><![CDATA[The syntax of the window.open method is given below: open (URL, windowName[, windowFeatures]) URL The URL of the page to open in the new window. This argument could be blank. windowName A name to be given to the new window. The name can be used to refer this window again. windowFeatures A string that determines [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=24&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The syntax of the window.open method is given below:</p>
<p><span style="color:#8f1e1e;"><code> <span style="color:#800000;">open (URL, windowName[, windowFeatures]) </span></code></span></p>
<p><strong>URL</strong><br />
The URL of the page to open in the new window. 	This argument could be blank.</p>
<p><strong>windowName</strong><br />
A name to be given to the new window. 	The name can be used to refer this window again.</p>
<p><strong>windowFeatures</strong><br />
A string that determines the various window  	features to be included in the popup window (like status bar, address bar etc)</p>
<p>The following code opens a new browser window with standard features.</p>
<p><code> <span style="color:#8f1e1e;">window.open ("http://www.javascript-coder.com","mywindow"); </span></code></p>
<p><strong>Note:</strong> The popups created using &#8216;window.open()&#8217; can get blocked by 	popup blockers.<br />
<a href="http://www.javascript-coder.com/window-popup/unblockable-popup.phtml">Click here to find out how to create popups that  	does not get blocked.</a></p>
<h3>Changing the features of the Popup</h3>
<p>You can control the features of the popup using the last argument to 	the window.open method. The following code opens a window with a status bar  	and no extra features.<br />
<code> <span style="color:#8f1e1e;">window.open ("http://www.javascript-coder.com","mywindow","status=1"); </span></code></p>
<p>The code below opens a window with toolbar and status bar.<br />
<code> <span style="color:#8f1e1e;">window.open ("http://www.javascript-coder.com",<br />
"mywindow","status=1,toolbar=1"); </span></code></p>
<p>The table shows the features and the string tokens you can use:</p>
<table border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td>status</td>
<td>The status bar at the bottom of the window.</td>
</tr>
<tr>
<td>toolbar</td>
<td>The standard browser toolbar, with buttons such as Back and Forward.</td>
</tr>
<tr>
<td>location</td>
<td>The Location entry field where you enter the URL.</td>
</tr>
<tr>
<td>menubar</td>
<td>The menu bar of the window</td>
</tr>
<tr>
<td>directories</td>
<td>The standard browser directory buttons, such as What&#8217;s New and What&#8217;s Cool</td>
</tr>
<tr>
<td>resizable</td>
<td>Allow/Disallow the user to resize the window.</td>
</tr>
<tr>
<td>scrollbars</td>
<td>Enable the scrollbars if the document is bigger than the window</td>
</tr>
<tr>
<td>height</td>
<td>Specifies the height of the window in pixels. (example: height=&#8217;350&#8242;)</td>
</tr>
<tr>
<td>width</td>
<td>Specifies the width of the window in pixels.</td>
</tr>
</tbody>
</table>
<p><strong>Examples</strong><br />
The following code opens a window with menu bar. The window is resizable  	and is having 350 pixels width and 250 pixels height.<br />
<code> <span style="color:#8f1e1e;">window.open ("http://www.javascript-coder.com",<br />
"mywindow","menubar=1,resizable=1,width=350,height=250"); </span></code><br />
<a href="http://www.javascript-coder.com/window-popup/javascript-window-open-example1.html" target="_blank">Example 1</a></p>
<p>A window with location bar, status bar, scroll bar and of size 100 X 100<br />
<code> <span style="color:#8f1e1e;">window.open ("http://www.javascript-coder.com",<br />
"mywindow","location=1,status=1,scrollbars=1,<br />
width=100,height=100"); </span></code><br />
<a href="http://www.javascript-coder.com/window-popup/javascript-window-open-example2.html" target="_blank">Example 2</a></p>
<h3>Moving the window to a desired location</h3>
<p>You can use the window.moveTo function to move the popup window to  	a desired location.<br />
The code below shows positioning the popup at a desired location</p>
<p><code> <span style="color:#8f1e1e;">function mypopup()<br />
{<br />
mywindow = window.open ("http://www.javascript-coder.com",<br />
"mywindow","location=1,status=1,scrollbars=1,<br />
width=100,height=100");<br />
mywindow.moveTo(0,0);<br />
} </span></code><br />
The code positions the popup on the top left corner of the screen.</p>
<h3>Putting it all together</h3>
<p>Now we will combine all these information to create the popup windows of different 	types.<br />
The Code below opens a popup window when you enter the page:</p>
<p><span style="color:#800000;"><code> &lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;JavaScript  Popup Example 3&lt;/title&gt;<br />
&lt;/head&gt;<br />
</code><code> &lt;SCRIPT  language="JavaScript1.2"&gt;<br />
function poponload()<br />
{<br />
testwindow=  window.open ("", "mywindow",<br />
"location=1,status=1,scrollbars=1,width=100,height=100");<br />
testwindow.moveTo(0,0);<br />
}<br />
&lt;/SCRIPT&gt;<br />
</code><code> &lt;body </code><code> onload="javascript: poponload()"&gt;<br />
</code><code> &lt;H1&gt;JavaScript Popup Example  3&lt;/H1&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt; </code></span></p>
<p>Notice that the URL is kept blank. This will open a blank window. 	You can see the code in work in this file:<br />
<a href="http://www.javascript-coder.com/window-popup/javascript-popup-example3.html" target="_blank">JavaScript Popup Example 3</a></p>
<h3>Popup On Exit</h3>
<p>The following code pops up a window when the user exits a page.</p>
<p><span style="color:#800000;"><code> &lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;JavaScript  Popup Example 3&lt;/title&gt;<br />
&lt;/head&gt; </code><code><br />
&lt;SCRIPT  language="JavaScript1.2"&gt;<br />
function exitpop()<br />
{<br />
my_window=  window.open ("",<br />
"mywindow1","status=1,width=350,height=150");<br />
my_window.document.write('&lt;H1&gt;Popup  Test!&lt;/H1&gt;');<br />
}<br />
&lt;/SCRIPT&gt;<br />
</code><code> &lt;body </code><code>onunload="javascript: exitpop()"</code> <code> &gt;<br />
&lt;H1&gt;JavaScript Popup Example  4&lt;/H1&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt; </code></span></p>
<p>The code contains an extra line:<br />
<code> <span style="color:#8f1e1e;">my_window.document.write('&lt;H1&gt;Popup Test!&lt;/H1&gt;') </span></code><br />
This code displays a line &#8216;Popup Test!&#8217; in the popup.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gauravsrivastava.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gauravsrivastava.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gauravsrivastava.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=24&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gauravsrivastava.wordpress.com/2009/06/29/using-the-window-open-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a760867d1b124308f778d4e3755cf73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaurav</media:title>
		</media:content>
	</item>
		<item>
		<title>Cursors: An Overview</title>
		<link>http://gauravsrivastava.wordpress.com/2009/06/26/cursors-an-overview/</link>
		<comments>http://gauravsrivastava.wordpress.com/2009/06/26/cursors-an-overview/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 10:16:58 +0000</pubDate>
		<dc:creator>Gaurav Srivastava</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://gauravsrivastava.wordpress.com/2009/06/26/cursors-an-overview/</guid>
		<description><![CDATA[SQL Server is very good at handling sets of data. For example, you can use a single UPDATE statement to update many rows of data. There are times when you want to loop through a series of rows a perform processing for each row. In this case you can use a cursor. DECLARE @AuthorID char(11) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=20&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>SQL Server is very good at handling sets of data. For example, you can use a single UPDATE statement to update many rows of data. There are times when you want to loop through a series of rows a perform processing for each row. In this case you can use a cursor.</p>
<p>DECLARE @AuthorID char(11)</p>
<p>DECLARE c1 CURSOR READ_ONLY<br />
FOR<br />
SELECT au_id<br />
FROM authors</p>
<p>OPEN c1</p>
<p>FETCH NEXT FROM c1<br />
INTO @AuthorID</p>
<p>WHILE @@FETCH_STATUS = 0<br />
BEGIN</p>
<p>PRINT @AuthorID</p>
<p>FETCH NEXT FROM c1<br />
INTO @AuthorID</p>
<p>END</p>
<p>CLOSE c1<br />
DEALLOCATE c1</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gauravsrivastava.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gauravsrivastava.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gauravsrivastava.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gauravsrivastava.wordpress.com&amp;blog=8332355&amp;post=20&amp;subd=gauravsrivastava&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gauravsrivastava.wordpress.com/2009/06/26/cursors-an-overview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1a760867d1b124308f778d4e3755cf73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gaurav</media:title>
		</media:content>
	</item>
	</channel>
</rss>
