<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9148345414902889873</id><updated>2024-10-05T11:51:06.933-07:00</updated><title type='text'>ASP.NET | C# |PHP|XML|MVC|SQL|MYSQL|Tutorials</title><subtitle type='html'>ASP.NET | C# |PHP|XML|MVC|SQL|MYSQL|Tutorials|Interview Questions</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-1777694126104159898</id><published>2013-11-30T09:45:00.005-08:00</published><updated>2013-11-30T09:45:41.410-08:00</updated><title type='text'>LDAP authentication using JAVA</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
package eclipsepackage;&lt;br /&gt;&lt;br /&gt;import javax.naming.Context;&lt;br /&gt;import javax.naming.InitialContext;&lt;br /&gt;import javax.naming.NamingException;&lt;br /&gt;import javax.naming.&lt;br /&gt;
&lt;div dir=&quot;ltr&quot;&gt;
&lt;wbr&gt;&lt;/wbr&gt;NamingEnumeration;&lt;br /&gt;import javax.naming.&lt;wbr&gt;&lt;/wbr&gt;NameAlreadyBoundException;&lt;br /&gt;
import javax.naming.directory.*;&lt;br /&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;public class test {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;final static String ldapServerName = &quot;LDAP://&lt;a href=&quot;http://10.22.122.30:389/DC=dubai-holding,DC=ezone&quot; target=&quot;_blank&quot;&gt;127.0.0.1:389/DC=&lt;wbr&gt;&lt;/wbr&gt;martinkabraham,DC=com&lt;/a&gt;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;final static String dc1=&quot;martinkabraham&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final static String rootdn = &quot;OU=Martin&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final static String rootpass = &quot;password&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final static String rootContext = &quot;OU=Martin&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final static String username=&quot;martin.abraham&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Properties env = new Properties();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put( Context.INITIAL_CONTEXT_&lt;wbr&gt;&lt;/wbr&gt;FACTORY,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;com.sun.jndi.ldap.&lt;wbr&gt;&lt;/wbr&gt;LdapCtxFactory&quot; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put(Context.REFERRAL, &quot;follow&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put( Context.PROVIDER_URL, ldapServerName);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put(Context.SECURITY_&lt;wbr&gt;&lt;/wbr&gt;AUTHENTICATION, &quot;simple&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put( Context.SECURITY_PRINCIPAL, new String(dc1 + &quot;\\&quot;+username) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; env.put( Context.SECURITY_CREDENTIALS, rootpass );&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DirContext ctx = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NamingEnumeration results = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx = new InitialDirContext(env);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SearchControls controls = new SearchControls();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; controls.setSearchScope(&lt;wbr&gt;&lt;/wbr&gt;SearchControls.SUBTREE_SCOPE);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results = ctx.search(&quot;&quot;, &quot;(sAMAccountName=&quot;+username+&quot;)&lt;wbr&gt;&lt;/wbr&gt;&quot;, controls);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (results.hasMore()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SearchResult searchResult = (SearchResult) results.next();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attributes attributes = searchResult.getAttributes();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(attributes.get(&quot;cn&quot;)!=null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // login here .... user exist&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;SUCCESS&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println(&quot;F&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Throwable e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } finally {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results != null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ctx != null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;}&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/1777694126104159898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2013/11/ldap-authentication-using-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1777694126104159898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1777694126104159898'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2013/11/ldap-authentication-using-java.html' title='LDAP authentication using JAVA'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-8349665709989359440</id><published>2013-11-24T21:25:00.002-08:00</published><updated>2013-11-30T09:41:12.947-08:00</updated><title type='text'>Android Browser File Down Load</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Android browser will not download file in button Post events. In post events the file will be some .htm garbage file. to over come this do as below.&lt;br /&gt;
&lt;br /&gt;
In download button click&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;protected void ImageButton1_Click(object sender, ImageClickEventArgs e)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&quot;download-file.aspx&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
and on&amp;nbsp; download-file.aspx file do as below&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
&lt;br /&gt;
public partial class mobile_download_file : System.Web.UI.Page&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string filename = &quot;usermanual.pdf&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &quot;application/octet-stream&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + &quot;&quot; + filename + &quot;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(Server.MapPath(Request.ApplicationPath) + &quot;\\&quot; + filename);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.TransmitFile(Server.MapPath(Request.ApplicationPath) + &quot;\\&quot; + filename);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/8349665709989359440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2013/11/android-browser-file-down-load.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8349665709989359440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8349665709989359440'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2013/11/android-browser-file-down-load.html' title='Android Browser File Down Load'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-3542464921389847172</id><published>2010-12-11T04:26:00.000-08:00</published><updated>2010-12-11T04:28:59.304-08:00</updated><title type='text'>OAuth</title><content type='html'>&amp;nbsp;OAuth an open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Almost all Social networks&amp;nbsp; provide a method to share there data&amp;nbsp; with data with others by the method of OAuth. By this Authorization&amp;nbsp; for example if i am integrating Twitter with my website the user dosen&#39;t need to provide the uname/password of him in my site but they can authenticate in twitter itself and he can give allow permission so that he can view his Tweets and post of others and can Tweet from mysite to Twitter...&lt;br /&gt;
This is a&amp;nbsp; good technology as OpenID. very very Secure.&lt;br /&gt;
&lt;br /&gt;
I have implemented it already for Picassa,Twitter,Facebook and Youtube. for example u can check this site in development stage.&lt;br /&gt;
&lt;br /&gt;
http://208.109.209.105:1081/phaseoflife/</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/3542464921389847172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/12/oauth.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3542464921389847172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3542464921389847172'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/12/oauth.html' title='OAuth'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-7273668752604094896</id><published>2010-08-02T01:12:00.000-07:00</published><updated>2010-08-02T01:18:08.667-07:00</updated><title type='text'>Prevent Pages from going to history on Back Button click using Javascript</title><content type='html'>Hi we can prevent the&amp;nbsp; pages ability to go back by using java script. Suppose From Default.aspx page we go to Default2.aspx and we dont want to go to default.aspx from default2.aspx. for this we can place make place javascript on&amp;nbsp; default.aspx.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;Place this&amp;nbsp; between head tags of Default.aspx. &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;lt;script type = &quot;text/javascript&quot; &amp;gt;&lt;br /&gt;
function disableBackButton()&lt;br /&gt;
{&lt;br /&gt;
window.history.forward(1);&lt;br /&gt;
}&lt;br /&gt;
setTimeout(&quot;disableBackButton()&quot;, 0);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;script type=&quot;text/javascript&quot;&gt;
function disableBackButton()
{
window.history.forward(1);
}
setTimeout(&quot;disableBackButton()&quot;, 0);
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;call this script in body load and unload events so that it will work on all browsers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload=&quot;disableBackButton();&quot; onunload=&quot;disableBackButton();&quot;&amp;gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/7273668752604094896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/08/prevent-pages-from-going-to-history-on.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7273668752604094896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7273668752604094896'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/08/prevent-pages-from-going-to-history-on.html' title='Prevent Pages from going to history on Back Button click using Javascript'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-7232764222620023666</id><published>2010-07-31T02:10:00.000-07:00</published><updated>2010-08-02T01:22:10.453-07:00</updated><title type='text'>ViewState and Hacking ViewState Data In ASP.NET Beware!!!!!!!!</title><content type='html'>Asp.net View State help us to retrieve data after Postbacks. But&amp;nbsp; remember this data is generally not safe as it is simply serialized&amp;nbsp; and stored in the rendered HTML.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Suppose&amp;nbsp; this is the Server Code&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ViewState[&quot;password&quot;] = &quot;mypassword&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
Its Rendered HTMLis like this&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TFPnb2CaYBI/AAAAAAAAAIM/seDGcmZFWGc/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;153&quot; src=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TFPnb2CaYBI/AAAAAAAAAIM/seDGcmZFWGc/s400/Untitled.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
U can Decode&amp;nbsp; View State data Simply like this&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; string data = &quot;/wEPDwUKMTQ2OTkzNDMyMQ8WAh4IcGFzc3dvcmQFCm15cGFzc3dvcmRkZBFNlyb3T/zu6sd7uJs/TN9V0e5z&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string password = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(data));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(password);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
So the Result will be Like This&lt;br /&gt;
&lt;br /&gt;
?     1469934321     password  &lt;span style=&quot;color: red;&quot;&gt;mypassworddd&lt;/span&gt; M?&amp;amp;?O????{???L?U??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See the data Decode... So Beware Dont Store Important data in ViewState as the it can be easily reteived from the HTML..&amp;nbsp; You can enable automatic&lt;br /&gt;
hash codes to prevent view state tampering, and you can even encrypt view state to prevent it from being decoded</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/7232764222620023666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/viewstate-and-hacking-viewstate-data-in.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7232764222620023666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7232764222620023666'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/viewstate-and-hacking-viewstate-data-in.html' title='ViewState and Hacking ViewState Data In ASP.NET Beware!!!!!!!!'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/__L6As6GvDkY/TFPnb2CaYBI/AAAAAAAAAIM/seDGcmZFWGc/s72-c/Untitled.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-1707182317949697987</id><published>2010-07-28T12:49:00.000-07:00</published><updated>2010-07-28T12:57:45.848-07:00</updated><title type='text'>URL Mapping in ASP.NET</title><content type='html'>In an ideal world, we&#39;d design our Web applications perfectly the first  time. Pages would be created in the proper folder and stay there. For that  matter, end users would never care about the URLs of the pages in our Web  applications, so we could put pages anywhere we wanted without worrying  about it.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
Url mapping is done in the system.web section of the web.config file.&lt;br /&gt;
&lt;br /&gt;
an Example of url mapping is described&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/__L6As6GvDkY/TFCLT0jL4eI/AAAAAAAAAH8/lo6e1aBrqOU/s1600/untitled.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;61&quot; src=&quot;http://1.bp.blogspot.com/__L6As6GvDkY/TFCLT0jL4eI/AAAAAAAAAH8/lo6e1aBrqOU/s400/untitled.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
What does this mean?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; it simply means if we write a code&amp;nbsp;&amp;nbsp; Response.Redirect(&quot;Default2.aspx&quot;)in Default.aspx page, the URL reads as Default2.aspx but the browser displays the page Default.aspx since the Default2.aspx page is&amp;nbsp; mapped to Default.aspx.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This are the basics of url Rewriting and Routing procedures done in MVC architecture. This all helps in SEO a lot...&lt;br /&gt;
We can enforce the folder structure using URL mapping...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;!--Session data--&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/1707182317949697987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/url-mapping-in-aspnet.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1707182317949697987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1707182317949697987'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/url-mapping-in-aspnet.html' title='URL Mapping in ASP.NET'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/__L6As6GvDkY/TFCLT0jL4eI/AAAAAAAAAH8/lo6e1aBrqOU/s72-c/untitled.JPG" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-5242255300350008539</id><published>2010-07-28T03:02:00.000-07:00</published><updated>2010-07-28T03:02:48.533-07:00</updated><title type='text'>Get Number of  mysql connections if  Connection are not cached</title><content type='html'>string&amp;nbsp; Qry=&quot; FLUSH STATUS ;SHOW GLOBAL STATUS LIKE &#39;%Max_used_connections%&#39; &quot;;&lt;br /&gt;
MysqlDataAdapter ad =new MysqlDataAdapter(Qry);&lt;br /&gt;
so fill that to dataset and u will get that. &lt;br /&gt;
&lt;br /&gt;
If connection is cached u need to do work on thread cache and work on&amp;nbsp; that.</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/5242255300350008539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/get-number-of-mysql-connections-if.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5242255300350008539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5242255300350008539'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/get-number-of-mysql-connections-if.html' title='Get Number of  mysql connections if  Connection are not cached'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-6691402723778828763</id><published>2010-07-28T01:14:00.000-07:00</published><updated>2010-07-28T01:32:36.676-07:00</updated><title type='text'>Send Email in Asp.net ..    System.Web.Mail</title><content type='html'>&amp;nbsp;We can easily sent emails from asp.net using Mail Message which comes under name-space System.Web.Mail. &lt;br /&gt;
&lt;br /&gt;
The Code is as Follows...&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
using &lt;span class=&quot;il&quot;&gt;System&lt;/span&gt;.&lt;span class=&quot;il&quot;&gt;Web&lt;/span&gt;.Mail;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;MailMessage messa = new MailMessage();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;messa.From = &quot;&lt;a href=&quot;http://martinkabraham.ispg.in/&quot; target=&quot;_blank&quot;&gt;martinkabraham.gmail.com&lt;/a&gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;messa.To = &quot;&lt;a href=&quot;mailto:martinkabraham@gmail.com&quot;&gt;martinkabraham@gmail.com&lt;/a&gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;messa.Subject = &quot;Test Mail&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;messa.BodyFormat = MailFormat.Html;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;messa.Body = &quot;Hai all&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SmtpMail.SmtpServer = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SmtpMail.Send(messa); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If Smtp throws exception then replace&amp;nbsp; SmtpMail.SmtpServer = &quot;&quot;; to&amp;nbsp; SmtpMail.SmtpServer = &quot;localhost&quot;;</content><link rel='enclosure' type='' href='http://martinkabraham.blogspot.com/2010/07/send-email-in-aspnet.html#more' length='0'/><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/6691402723778828763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/send-email-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6691402723778828763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6691402723778828763'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/send-email-in-aspnet.html' title='Send Email in Asp.net ..    System.Web.Mail'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-9206951236049127290</id><published>2010-07-26T03:02:00.000-07:00</published><updated>2010-07-28T01:34:06.891-07:00</updated><title type='text'>C# code Protection Using .NET REACTOR</title><content type='html'>The assembly (.exe, .dll) etc we build using .Net Framework&amp;nbsp; can be decombiled using visual studio command Promt.&amp;nbsp; ildasm is the commad that we can use to open an assembly as Resource hacker is doing.&lt;br /&gt;
&lt;br /&gt;
C:\Program Files\Microsoft Visual Studio 9.0\VC&amp;gt;ildasm&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
This will Pull up ILDASM window for us. &lt;br /&gt;
&lt;br /&gt;
This is the General Structure of a .net Assembly&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TE1gc0hhdAI/AAAAAAAAAHc/fhxTmKHMsu8/s1600/fig527_02.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TE1gc0hhdAI/AAAAAAAAAHc/fhxTmKHMsu8/s320/fig527_02.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
So select the exe file from the File menu in that. We can see the decombiled file as shown&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/__L6As6GvDkY/TE1ek0bTU0I/AAAAAAAAAHU/a2orAAuL8gY/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;http://2.bp.blogspot.com/__L6As6GvDkY/TE1ek0bTU0I/AAAAAAAAAHU/a2orAAuL8gY/s200/Untitled.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Thus our Function and code Assembly are visible to Others. To over come this issue we combile that code using .NET Reactor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET Reactor is a powerful code protection and software licensing system for software written for the .NET Framework, and supports all languages that generate. .NET Reactor prevents decompilation by a variety of methods which convert your .NET assemblies into processes which no existing tool can decompile ( and which are also very likely to prevent decompilation by any future tool). .NET Reactor builds a native code wall between potential hackers and your .NET assemblies by producing a file which cannot be understood directly as CIL. Because the CIL in your assembly is emitted intact only at run time or design time (in a form in which the source is completely inaccessible), no tool is capable of decompiling .NET Reactor protected assemblies. The native code wall created by .NET Reactor between the hacker and your source includes industry leading NecroBit technology, which is exclusive to .NET Reactor. .NET Reactor&#39;s protection has never been broken since the first release in 2004. These technologies make reconstruction of your source code more difficult by so many orders of magnitude that NecroBit is by far the most effective protection you can use for .NET assemblies. In addition to industry leading intellectual property protection, .NET Reactor provides powerful options for securing you revenue stream by enforcing licensing terms with a rich variety of trialversion and full version locks. .NET Reactor offers you an easy and reliable way to: - Secure your .NET applications and .NET libraries - Replace CIL code with native code - Perform additional layers of protection, including obfuscation - Merge assemblies, and - Protect your revenue by enforcing trial version restrictions and full version licensing terms.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;</content><link rel='enclosure' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/c-code-protection-using-net-reactor.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/9206951236049127290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/c-code-protection-using-net-reactor.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/9206951236049127290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/9206951236049127290'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/c-code-protection-using-net-reactor.html' title='C# code Protection Using .NET REACTOR'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/__L6As6GvDkY/TE1gc0hhdAI/AAAAAAAAAHc/fhxTmKHMsu8/s72-c/fig527_02.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-3247905839012886136</id><published>2010-07-24T11:45:00.000-07:00</published><updated>2010-07-28T01:34:50.361-07:00</updated><title type='text'>Xml Creation and Reading that to DataSet</title><content type='html'>&amp;nbsp;Creating XML and Reading that is&amp;nbsp; very important when we come to Web-service, Serialization etc&lt;br /&gt;
Here i just give the basics of&amp;nbsp; creating and reading xml.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ComponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
&lt;br /&gt;
//Creating Xml Node..........................&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument Xdoc = new XmlDocument();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlElement Xelm1 = Xdoc.CreateElement(&quot;MainNode&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xdoc.AppendChild(Xelm1);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Appending text node to the subnode........&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlElement Xelm2 = Xdoc.CreateElement(&quot;Number&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlText xmlText = Xdoc.CreateTextNode(&quot;data&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xelm2.AppendChild(xmlText);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Appending SubNode to Main Node....&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xelm1.AppendChild(Xelm2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Writing Xml ........................&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringWriter sw = new StringWriter();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlTextWriter xw = new XmlTextWriter(sw);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xw.Formatting = Formatting.Indented;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Xdoc.WriteTo(xw);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string xmlstr =&quot;&lt;newdataset&gt;&quot;+ sw.ToString()+&quot;&lt;/newdataset&gt;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Loading Data to DataSet From XML................&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataSet ds = new DataSet();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (DataTable dt in ds.Tables)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.BeginLoadData();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ds.ReadXml(new StringReader(xmlstr));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (DataTable dt in ds.Tables)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.EndLoadData();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Setting Datasource to datagridview..................&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataGridView1.DataSource = ds.Tables[&quot;MainNode&quot;];</content><link rel='enclosure' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/xml-creation-and-reading-that-to.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/3247905839012886136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/xml-creation-and-reading-that-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3247905839012886136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3247905839012886136'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/xml-creation-and-reading-that-to.html' title='Xml Creation and Reading that to DataSet'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-5952878153252455570</id><published>2010-07-23T12:44:00.000-07:00</published><updated>2010-07-28T01:35:42.200-07:00</updated><title type='text'>ASP.NET Viewstate MAC failed Error ... What is this?</title><content type='html'>&amp;nbsp;&amp;nbsp;&amp;nbsp; “&lt;b style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Validation of viewstate MAC failed&lt;/span&gt;&lt;/b&gt;. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.” &lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
in your ASP.NET application while clicking a button?&lt;br /&gt;
&lt;br /&gt;
The reason for this error is ASP.NET renders some hidden fields, such as the __EVENTVALIDATION field near the bottom of the form, immediately before the closing  tag. If event validation is enabled and a user clicks on a button before the page is rendered completely, then __EVENTVALIDATION field is not included in the data that is being posted. Therefore, the .NET Framework treats this postback as invalid and brings up this error.&lt;br /&gt;
&lt;br /&gt;
To resolve this error, a lot of developers set the page property &quot;EnableViewStateMac&quot; to false. Although this may resolve the error in some cases, this is not the preferred way.&lt;br /&gt;
&lt;br /&gt;
To resolve this error, if you are using .NET 3.5, upgrade to .NET 3.5 SP1. If you are using .NET 2.0, then upgrade to .NET 2.0 SP2.&lt;br /&gt;
&lt;br /&gt;
By default, in ASP.NET 3.5 SP1, all system-generated hidden fields are rendered at the top of the page. This makes sure that the information in these fields is sent to the server even if a postback is performed, before the page has finished loading.&lt;br /&gt;
&lt;br /&gt;
If you want to render system-generated fields at the bottom of the page, set the RenderAllHiddenFieldsAtTopOfForm property to False.&lt;br /&gt;
&lt;br /&gt;
&lt;pages renderallhiddenfieldsattopofform=&quot;false&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;/pages&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='enclosure' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/aspnet-viewstate-mac-failed-error-what.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/5952878153252455570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/aspnet-viewstate-mac-failed-error-what.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5952878153252455570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5952878153252455570'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/aspnet-viewstate-mac-failed-error-what.html' title='ASP.NET Viewstate MAC failed Error ... What is this?'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-871532967770093587</id><published>2010-07-19T03:30:00.000-07:00</published><updated>2010-07-28T01:36:26.419-07:00</updated><title type='text'>CAPTCHA  generation in asp.net c#</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEQs9ftQgGI/AAAAAAAAAGo/TMp45WD9JMc/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;108&quot; src=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEQs9ftQgGI/AAAAAAAAAGo/TMp45WD9JMc/s200/Untitled.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;CAPTCHA stands for &quot;completely automated public Turing test to tell computers and humans apart.&quot; What it means is, a program that can tell humans from machines using some type of generated test. A test most people can easily pass but a computer program cannot. Mainly intended to reduce spam on our websites.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Captcha generation here descibed below contain the following sections&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) A handler file (ashx) to produce captcha&lt;br /&gt;
&lt;br /&gt;
2)Validation of captcha.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Handler file Look like this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
captcha.ashx..................................................................&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ WebHandler Language=&quot;C#&quot; Class=&quot;captcha&quot; %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.SessionState;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Drawing.Imaging;&lt;br /&gt;
using System.Drawing.Drawing2D;&lt;br /&gt;
using System.IO;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class captcha : IHttpHandler {&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void ProcessRequest (HttpContext context) {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string text = context.Request[&quot;captcha&quot;].ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bitmap bmpimg = new Bitmap(100, 50);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphics g = Graphics.FromImage(bmpimg);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.FillRectangle(Brushes.Black, 0, 0, 100, 10);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.DrawString(text, new Font(&quot;Verdana&quot;, 18), new SolidBrush(Color.White), 0, 0);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemoryStream ms = new MemoryStream();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bmpimg.Save(ms, ImageFormat.Jpeg);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] data = ms.GetBuffer();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bmpimg.Dispose();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ms.Close();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.BinaryWrite(data);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.Flush();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.End();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool IsReusable {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next the aspx page ...&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/__L6As6GvDkY/TEQqunb80QI/AAAAAAAAAGU/bCCBzo9kJTI/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;186&quot; src=&quot;http://1.bp.blogspot.com/__L6As6GvDkY/TEQqunb80QI/AAAAAAAAAGU/bCCBzo9kJTI/s320/Untitled.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;asp:image &amp;nbsp;=&quot;&quot; id=&quot;imgcapthca&quot; runat=&quot;server&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;asp:textbox id=&quot;txtcaptchacheck&quot; runat=&quot;server&quot;&gt;&lt;/asp:textbox&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;asp:customvalidator id=&quot;CustomValidator1&quot; runat=&quot;server&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/asp:customvalidator&gt;&lt;/asp:image&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and Finally the CS page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Configuration;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Text;&lt;br /&gt;
&lt;br /&gt;
public partial class _Default : System.Web.UI.Page&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp; static string rndstrig;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!IsPostBack)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generate();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private void generate()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Random rnd = new Random();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rndstrig = rnd.Next(1000, 9999).ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgcapthca.ImageUrl = &quot;~/captcha.ashx?captcha=&quot; + rndstrig;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (txtcaptchacheck.Text == rndstrig)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.IsValid = true;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; args.IsValid = false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generate();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
the O/p will be like this&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEQrrSW0XUI/AAAAAAAAAGg/OuoDZDtelw4/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEQrrSW0XUI/AAAAAAAAAGg/OuoDZDtelw4/s320/Untitled.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='enclosure' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/captcha-generation-in-aspnet-c.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/871532967770093587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/captcha-generation-in-aspnet-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/871532967770093587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/871532967770093587'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/captcha-generation-in-aspnet-c.html' title='CAPTCHA  generation in asp.net c#'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/__L6As6GvDkY/TEQs9ftQgGI/AAAAAAAAAGo/TMp45WD9JMc/s72-c/Untitled.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-7351313867523457808</id><published>2010-07-18T22:27:00.000-07:00</published><updated>2010-07-18T22:34:08.064-07:00</updated><title type='text'>CSV generator for asp.net  c# without writing file in server...</title><content type='html'>Last topic (&lt;a href=&quot;http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c.html&quot;&gt;http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c.html&lt;/a&gt;) we see generating csv by saving that csv file to server folder that&amp;nbsp; need to set folder permissions (chmod(7,7,7)). Now lets see to generate csv without writing that to server.&lt;br /&gt;
Encoding.ASCII.GetBytes(CompleteCsv) will givbe the bye[] for the&amp;nbsp; Respose object to binary write. &lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;using System.Linq;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt = new DataTable();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Columns.Add(new DataColumn(&quot;SlNo&quot;, typeof(string)));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Columns.Add(new DataColumn(&quot;Name&quot;, typeof(string)));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataRow dr;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; 5; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dr = dt.NewRow();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dr[0] = i;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dr[1] = &quot;Name&quot; + i.ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Rows.Add(dr);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string csvdata = &quot;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int appflg = 0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (DataColumn dc in dt.Columns)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (appflg == 1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvdata = csvdata + &quot;,&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvdata = csvdata + dc.ColumnName;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; appflg = 1;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvdata = csvdata + &quot;\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string csvdata_row = &quot;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (DataRow drw in dt.Rows)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvdata_row = csvdata_row + drw[0] + &quot;,&quot; + drw[1];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvdata_row = csvdata_row + &quot;\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string CompleteCsv = csvdata + csvdata_row;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AppendHeader(&quot;content-disposition&quot;, &quot;attachment;filename=00123.csv&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &quot;application/octect-stream&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.BinaryWrite(Encoding.ASCII.GetBytes(CompleteCsv));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Flush();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/7351313867523457808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c-without.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7351313867523457808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/7351313867523457808'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c-without.html' title='CSV generator for asp.net  c# without writing file in server...'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-8048447562832697797</id><published>2010-07-17T14:53:00.000-07:00</published><updated>2010-07-17T15:24:01.933-07:00</updated><title type='text'>ASP .net PAGE CACHING and Substitution Control</title><content type='html'>Here we can have some basics about asp.net page caching. Think about a situations in which we are paging lakhs of data&amp;nbsp; in this case response each times goes to server and if the users are large in number that site goes to stuck definitely. It is worth to note that every post backed pages are in server memory and which are eating&amp;nbsp; server memory.&amp;nbsp; To over come this we use cache in asp.net pages.&lt;br /&gt;
&lt;br /&gt;
Cache can be on same server or on another server. Cache have a duration and server will handle the post back only after the cache is expired. Till the page is in cache post back are not handled by the server.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Let us see the situation with and with out cache..&lt;br /&gt;
suppose that we&amp;nbsp; have a button and a label in an aspx page.&lt;br /&gt;
&lt;br /&gt;
on each button click we will get the Time from server..&amp;nbsp; This means server is handling the post-back event or request.&lt;br /&gt;
&lt;br /&gt;
protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;
{&lt;br /&gt;
Label1.Text = System.DateTime.Now.ToString();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now suppose i am going to put that page in a cache..&lt;br /&gt;
&lt;br /&gt;
for that in aspx source i add the following&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ OutputCache Duration=&quot;1000&quot; VaryByParam=&quot;None&quot;%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So that that page will be in cache for 1 sec since Duration is 1000ms.(1000ms=1 sec)&lt;br /&gt;
so now you press the button frequently you can see that the time in the label is not changing for 1 sec since server is idle in this situation.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEIrmwrQPVI/AAAAAAAAAF8/ZRjb6UGDIAI/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;161&quot; src=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEIrmwrQPVI/AAAAAAAAAF8/ZRjb6UGDIAI/s320/Untitled.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
so the entire page is cached for 1 sec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now suppose we want some dynamic data to be displayed in a cached page. for that we use Substitution control&lt;br /&gt;
&lt;br /&gt;
Drag that control and place it in the form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public static string GetCurrentDateTime(HttpContext context)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return DateTime.Now.ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
then for substitution control set the method name as the function name have HTTPCOntext&amp;nbsp; response.&lt;br /&gt;
&lt;br /&gt;
&lt;asp:substitution id=&quot;Substitution1&quot; runat=&quot;server&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MethodName=&quot;GetCurrentDateTime&quot; /&amp;gt;&lt;/asp:substitution&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEItdF2bvUI/AAAAAAAAAGE/yNO_3mFV6k4/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;45&quot; src=&quot;http://4.bp.blogspot.com/__L6As6GvDkY/TEItdF2bvUI/AAAAAAAAAGE/yNO_3mFV6k4/s320/Untitled.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now on button press u can see that Substitution control time chnages inside it while no change in label.&lt;br /&gt;
&lt;br /&gt;
Thus we can display data in a chached page id data need to be dynamic..</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/8048447562832697797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/asp-net-page-caching-and-substitution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8048447562832697797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8048447562832697797'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/asp-net-page-caching-and-substitution.html' title='ASP .net PAGE CACHING and Substitution Control'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/__L6As6GvDkY/TEIrmwrQPVI/AAAAAAAAAF8/ZRjb6UGDIAI/s72-c/Untitled.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-8171468849647822127</id><published>2010-07-16T22:46:00.000-07:00</published><updated>2010-07-17T01:11:43.990-07:00</updated><title type='text'>CSV generator for asp.net  c#</title><content type='html'>&amp;nbsp;The term csv stands for Comma Seperated values, means each value is seperated by simply a&amp;nbsp; comma.&lt;br /&gt;
eg:martin,sobin,alex&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The importance of csv is that it can open in excel,Open-office etc. so if we want to export some db data to excel .. the coder can export that to csv so the user can best fit that on Excel or&amp;nbsp; Open-office&lt;br /&gt;
&lt;br /&gt;
This code will help you to generate csv from a dynamically created datable....&lt;br /&gt;
This example pull&amp;nbsp; download window to download csv file and save that to local machine.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;using System;&lt;br /&gt;
using System.Configuration;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.IO;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// csv Generator...Martin&lt;br /&gt;
DataTable dt = new DataTable();&lt;br /&gt;
dt.Columns.Add(new DataColumn(&quot;SlNo&quot;,typeof(string)));&lt;br /&gt;
dt.Columns.Add(new DataColumn(&quot;Name&quot;, typeof(string)));&lt;br /&gt;
&lt;br /&gt;
DataRow dr;&lt;br /&gt;
&lt;br /&gt;
for (int i = 0; i &amp;lt; 5; i++)&lt;br /&gt;
{&lt;br /&gt;
dr = dt.NewRow();&lt;br /&gt;
dr[0] = i;&lt;br /&gt;
dr[1] = &quot;Name&quot; + i.ToString();&lt;br /&gt;
dt.Rows.Add(dr);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
string csvdata=&quot;&quot;;&lt;br /&gt;
int appflg = 0;&lt;br /&gt;
foreach (DataColumn dc in dt.Columns)&lt;br /&gt;
{&lt;br /&gt;
if (appflg == 1)&lt;br /&gt;
{&lt;br /&gt;
csvdata = csvdata + &quot;,&quot;;&lt;br /&gt;
}&lt;br /&gt;
csvdata =csvdata+dc.ColumnName;&lt;br /&gt;
appflg = 1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
csvdata = csvdata + &quot;\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
string csvdata_row=&quot;&quot;;&lt;br /&gt;
foreach (DataRow drw in dt.Rows)&lt;br /&gt;
{&lt;br /&gt;
csvdata_row = csvdata_row + drw[0] + &quot;,&quot; + drw[1];&lt;br /&gt;
csvdata_row = csvdata_row + &quot;\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
string CompleteCsv = csvdata + csvdata_row;&lt;br /&gt;
StreamWriter sw = new StreamWriter(Server.MapPath(Request.ApplicationPath)+&quot;\\mycsv.csv&quot;);&lt;br /&gt;
sw.Write(CompleteCsv);&lt;br /&gt;
sw.Close();&lt;br /&gt;
&lt;br /&gt;
FileStream fd = new FileStream(Server.MapPath(Request.ApplicationPath) + &quot;\\mycsv.csv&quot;,FileMode.Open);&lt;br /&gt;
byte[] data=new byte[(int)fd.Length];&lt;br /&gt;
fd.Read(data, 0, (int)fd.Length);&lt;br /&gt;
fd.Flush();&lt;br /&gt;
fd.Close();&lt;br /&gt;
&lt;br /&gt;
Response.AppendHeader(&quot;content-disposition&quot;, &quot;attachment;filename=00123.csv&quot;);&lt;br /&gt;
Response.ContentType = &quot;application/octect-stream&quot;;&lt;br /&gt;
Response.BinaryWrite(data);&lt;br /&gt;
Response.Flush();&lt;br /&gt;
Response.End();</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/8171468849647822127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8171468849647822127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/8171468849647822127'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/csv-generator-for-aspnet-c.html' title='CSV generator for asp.net  c#'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-6539568549561277950</id><published>2010-07-03T01:19:00.000-07:00</published><updated>2010-07-18T08:21:26.644-07:00</updated><title type='text'>Skin Files in Asp.net  ( App_Themes) Easily apply style to Server Controls</title><content type='html'>To Customize server Controls , ie having different background image,fore-color,bold etc&amp;nbsp; it is hard to go to each control and set its properties or css class. Asp.net provide an easy way to manage this. By use if Skin files we are able to manage that.&lt;br /&gt;
&lt;br /&gt;
Website-&amp;gt;AddNewItem-&amp;gt;SkinFile&lt;br /&gt;
&lt;br /&gt;
Skin file will be added to the Project.Vs will automatically add that to App_Themes-&amp;gt;SkinFiles-&amp;gt;skin.skin.&lt;br /&gt;
To bring that skin file to our page go to Source view and&amp;nbsp; add&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ Page Language=&quot;C#&quot;&lt;b style=&quot;background-color: red;&quot;&gt; Theme=&quot;SkinFile&quot;&lt;/b&gt; AutoEventWireup=&quot;true&quot;&amp;nbsp; CodeFile=&quot;Default.aspx.cs&quot; Inherits=&quot;_Default&quot; %&amp;gt;&amp;nbsp; where SkinFile is the name of the skin file&amp;nbsp; you are adding.&lt;br /&gt;
&lt;br /&gt;
Now Lets See the Structure of Skin File&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TC70y1tPt8I/AAAAAAAAAFA/Rkejuyz-trM/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;16&quot; src=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TC70y1tPt8I/AAAAAAAAAFA/Rkejuyz-trM/s640/Untitled.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;asp:textbox&amp;nbsp;&amp;nbsp; runat=&quot;server&quot;&gt;&lt;/asp:textbox&amp;nbsp;&amp;nbsp;&gt;&lt;br /&gt;
&lt;br /&gt;
The above Skin is for TextBox... note the Skinid=&quot;Browse&quot; so that we can use that ID to get that Particular skin on Textbox&lt;br /&gt;
&lt;br /&gt;
See the aspx page&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TC74dLsmtYI/AAAAAAAAAFI/vflZNfc1lMI/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;17&quot; src=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/TC74dLsmtYI/AAAAAAAAAFI/vflZNfc1lMI/s640/Untitled.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;asp:textbox id=&quot;TextBox1&quot; runat=&quot;server&quot;&gt;&lt;br /&gt;
&lt;/asp:textbox&gt; &lt;br /&gt;
Now&amp;nbsp; you can see that that particular Skin is applied to text box. Like this can apply any number of Skins to all server controls. We can also write diff SkinId in the same Skin Files.&lt;br /&gt;
&lt;br /&gt;
The Folder Structure is mentioned Below&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/__L6As6GvDkY/TC76MYDg_pI/AAAAAAAAAFQ/gjSnjy9Ks1k/s1600/Untitled.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;155&quot; src=&quot;http://2.bp.blogspot.com/__L6As6GvDkY/TC76MYDg_pI/AAAAAAAAAFQ/gjSnjy9Ks1k/s200/Untitled.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/6539568549561277950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/skin-files-in-aspnet-appthemes.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6539568549561277950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6539568549561277950'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/07/skin-files-in-aspnet-appthemes.html' title='Skin Files in Asp.net  ( App_Themes) Easily apply style to Server Controls'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/__L6As6GvDkY/TC70y1tPt8I/AAAAAAAAAFA/Rkejuyz-trM/s72-c/Untitled.jpg" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-6397589610650118109</id><published>2010-06-25T02:16:00.001-07:00</published><updated>2010-06-28T02:31:55.423-07:00</updated><title type='text'>How to Effectively Validate ASP.NET  Page...when Javascript disabled in Browser ( When Validation controls  become useless)</title><content type='html'>Consider a situation Like this  .....&lt;br /&gt;
asp:TextBox ID=&quot;USERNAME&quot; runat=&quot;server&quot; asp:TextBox&lt;br /&gt;
&lt;br /&gt;
asp:RequiredFieldValidator&lt;br /&gt;
ID=&quot;RequiredFieldValidator1&quot; runat=&quot;server&quot;&lt;br /&gt;
ErrorMessage=&quot;USER NAME CANNOT BE BLANK&quot; ControlToValidate=&quot;USERNAME&quot;&amp;gt;asp:RequiredFieldValidator&lt;br /&gt;
&lt;br /&gt;
asp:Button ID=&quot;submit&quot; runat=&quot;server&quot; Text=&quot;SUbmit&quot; onclick=&quot;submit_Click&quot;&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
protected void submit_Click(object sender, EventArgs e)&lt;br /&gt;
{&lt;br /&gt;
Response.Write(&quot;I am fired.........!!!&quot;);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
Since we have the required field validator over there &quot;submit_Click &quot; works only when it is not blank...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Try to disable JavaScript on  your Browser and press button.   You can see Post back happen also the validator message comes but the code goes to execution by printing &quot;I am fired.........!!!&quot;   ...  So a hacker can easily destroy your validation my disabling java script in browser...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So my Friends go for this code in Button Click&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
protected void submit_Click(object sender, EventArgs e)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
if (Page.IsValid)&lt;br /&gt;
{&lt;br /&gt;
Response.Write(&quot;I am fired.........!!!&quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The intelligent .net checks this in Server side. So code will execute only if page.Isvalid=true.....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks for using System.Web.UI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:)</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/6397589610650118109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/06/how-to-effectively-validate-aspnet.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6397589610650118109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/6397589610650118109'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/06/how-to-effectively-validate-aspnet.html' title='How to Effectively Validate ASP.NET  Page...when Javascript disabled in Browser ( When Validation controls  become useless)'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-1171528333819623418</id><published>2010-04-26T09:26:00.000-07:00</published><updated>2010-04-26T09:27:49.876-07:00</updated><title type='text'>Delete asp.net Listbox item...(Multiple Items) !!</title><content type='html'>&amp;nbsp;Suppose&amp;nbsp; ListBox1 be the list box with some items in it we can delete the selected items in the Listbox with the below code..&lt;br /&gt;
&lt;br /&gt;
for Multiple selection, enable the Multiple option of the List box to &quot;Multiple&quot;.. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; ListBox1.Items.Count; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int myindx = ListBox1.SelectedIndex;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (myindx &amp;gt;= 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ListBox1.Items[myindx].Selected == true)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListBox1.Items.RemoveAt(myindx);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;br /&gt;
&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot; /&gt;&lt;!--Session data--&gt;&lt;input id=&quot;jsProxy&quot; onclick=&quot;jsCall();&quot; type=&quot;hidden&quot; /&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/1171528333819623418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/delete-aspnet-listbox-itemmultiple.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1171528333819623418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1171528333819623418'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/delete-aspnet-listbox-itemmultiple.html' title='Delete asp.net Listbox item...(Multiple Items) !!'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-5708697011068092092</id><published>2010-04-26T01:57:00.001-07:00</published><updated>2010-07-18T08:22:52.148-07:00</updated><title type='text'>Asp.net List box to ListBox Transfer....</title><content type='html'>&lt;span class=&quot;basix&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
The ListBox control enables you to display a list of items to the user that the user can select by clicking. A ListBox control can provide single or multiple selections using the SelectionMode property. This tutorial show you how to choose multi items and move them to the other Listbox. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ListBox control enables you to display a list of items to the user that the user can select by clicking. A ListBox control can provide single or multiple selections using the SelectionMode property. The ListBox also provides the MultiColumn property to enable the display of items in columns instead of a straight vertical list of items. This allows the control to display more visible items and prevents the need for the user to scroll to an item. This tutorial show you how to move items of ListBox from one to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, you will need to import the using System.Collections&lt;b&gt; &lt;/b&gt;namespace. The System.Collections namespace contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hash tables and dictionaries. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;public void AddBtn_Click(Object Src, EventArgs E)&lt;br /&gt;
{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (lstAsset.SelectedIndex&amp;gt;=0)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lstAsset.Items.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (lstAsset.Items[i].Selected)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lasset.Contains(lstAsset.Items[i]))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lasset.Add(lstAsset.Items[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lasset.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lstSubordinateAsset.Items.Contains(((ListItem)lasset[i])))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lstSubordinateAsset.Items.Add(((ListItem)lasset[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;} lstAsset.Items.Remove(((ListItem)lasset[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;br /&gt;
&lt;br /&gt;
public void AddAllBtn_Click(Object Src, EventArgs E)&lt;br /&gt;
{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;while (lstAsset.Items.Count != 0)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lstAsset.Items.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lasset.Contains(lstAsset.Items[i]))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lasset.Add(lstAsset.Items[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lasset.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lstSubordinateAsset.Items.Contains(((ListItem)lasset[i])))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lstSubordinateAsset.Items.Add(((ListItem)lasset[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;lstAsset.Items.Remove(((ListItem)lasset[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;br /&gt;
&lt;br /&gt;
public void RemoveBtn_Click(Object Src, EventArgs E)&lt;br /&gt;
{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (lstSubordinateAsset.SelectedItem != null)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lstSubordinateAsset.Items.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (lstSubordinateAsset.Items[i].Selected)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lsubordinate.Contains(lstSubordinateAsset.Items[i]))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lsubordinate.Add(lstSubordinateAsset.Items[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lsubordinate.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lstAsset.Items.Contains(((ListItem)lsubordinate[i])))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lstAsset.Items.Add(((ListItem)lsubordinate[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;lstSubordinateAsset.Items.Remove(((ListItem)lsubordinate[i]));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;UpdateList.Add(lsubordinate[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;br /&gt;
&lt;br /&gt;
public void RemoveAllBtn_Click(Object Src, EventArgs E)&lt;br /&gt;
{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;while (lstSubordinateAsset.Items.Count != 0)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lstSubordinateAsset.Items.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lsubordinate.Contains(lstSubordinateAsset.Items[i]))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lsubordinate.Add(lstSubordinateAsset.Items[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;for (int i = 0; i &amp;lt; lsubordinate.Count; i++)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;if (!lstAsset.Items.Contains(((ListItem)lsubordinate[i])))&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;{  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 20px;&quot;&gt;&lt;span class=&quot;basix&quot;&gt;lstAsset.Items.Add(((ListItem)lsubordinate[i]));&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;lstSubordinateAsset.Items.Remove(((ListItem)lsubordinate[i]));&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;UpdateList.Add(lsubordinate[i]);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;basix&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;&amp;nbsp;also see this in code project............... thats&amp;nbsp; will also help all&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;basix&quot;&gt;http://www.codeproject.com/KB/aspnet/List_Box_Control.aspx &lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/5708697011068092092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/aspnet-list-box-to-listbox-transfer.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5708697011068092092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5708697011068092092'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/aspnet-list-box-to-listbox-transfer.html' title='Asp.net List box to ListBox Transfer....'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-1771242471555229299</id><published>2010-04-22T00:32:00.000-07:00</published><updated>2010-07-18T04:16:34.610-07:00</updated><title type='text'>POP3 (Post Office Protocol) in Asp.net to recieve email</title><content type='html'>Hi all .. let me Put Some begginging to read email from gmail using POP3.. all the details of your mail server can be get from gmail settings...&lt;br /&gt;
Socket programming enable us in doing this ... lets see that in simple&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
............. Code Goes Here...........................&lt;br /&gt;
...........name spaces&amp;nbsp; to be used........&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Data;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Configuration;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.Security;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI.WebControls;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.IO;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Net.NetworkInformation;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Net.Security;
&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Net.Sockets;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;and the code in the button Event&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;

{

TcpClient tcpclient = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; TcpClient(); &lt;span class=&quot;rem&quot;&gt;// create an instance of TcpClient&lt;/span&gt;

tcpclient.Connect(&lt;span class=&quot;str&quot;&gt;&quot;pop.gmail.com&quot;&lt;/span&gt;, 995); &lt;span class=&quot;rem&quot;&gt;// HOST NAME POP SERVER and gmail uses port number 995 for POP &lt;/span&gt;get this from gmail setting

System.Net.Security.SslStream sslstream = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; SslStream(tcpclient.GetStream()); &lt;span class=&quot;rem&quot;&gt;// This is Secure Stream // opened the connection between client and POP Server&lt;/span&gt;

sslstream.AuthenticateAsClient(&lt;span class=&quot;str&quot;&gt;&quot;pop.gmail.com&quot;&lt;/span&gt;); &lt;span class=&quot;rem&quot;&gt;// authenticate as client &lt;/span&gt;

&lt;span class=&quot;rem&quot;&gt;//bool flag = sslstream.IsAuthenticated; // check flag &lt;/span&gt;

System.IO.StreamWriter sw = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; StreamWriter(sslstream); &lt;span class=&quot;rem&quot;&gt;// Asssigned the writer to stream&lt;/span&gt;

System.IO.StreamReader reader = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; StreamReader(sslstream); &lt;span class=&quot;rem&quot;&gt;// Assigned reader to stream&lt;/span&gt;

sw.WriteLine(&lt;span class=&quot;str&quot;&gt;&quot;USER your_gmail_user_name@gmail.com&quot;&lt;/span&gt;); &lt;span class=&quot;rem&quot;&gt;// refer POP rfc command, there very few around 6-9 command&lt;/span&gt;

sw.Flush(); &lt;span class=&quot;rem&quot;&gt;// sent to server&lt;/span&gt;

sw.WriteLine(&lt;span class=&quot;str&quot;&gt;&quot;PASS your_gmail_password&quot;&lt;/span&gt;); 
sw.Flush();

sw.WriteLine(&lt;span class=&quot;str&quot;&gt;&quot;RETR 1&quot;&lt;/span&gt;); &lt;span class=&quot;rem&quot;&gt;// this will retrive your first email &lt;/span&gt;

sw.Flush();

sw.WriteLine(&lt;span class=&quot;str&quot;&gt;&quot;Quit &quot;&lt;/span&gt;); &lt;span class=&quot;rem&quot;&gt;// close the connection&lt;/span&gt;

sw.Flush();

&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; str = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty; 
&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; strTemp = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;

&lt;span class=&quot;kwrd&quot;&gt;while&lt;/span&gt; ((strTemp = reader.ReadLine()) != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;) 
{

&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (strTemp == &lt;span class=&quot;str&quot;&gt;&quot;.&quot;&lt;/span&gt;) &lt;span class=&quot;rem&quot;&gt;// find the . character in line&lt;/span&gt;

{

&lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;; 
}

&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (strTemp.IndexOf(&lt;span class=&quot;str&quot;&gt;&quot;-ERR&quot;&lt;/span&gt;) != -1) 
{

&lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;; 
}

str += strTemp;

}

Response.Write(str);

Response.Write(&lt;span class=&quot;str&quot;&gt;&quot;
&quot;&lt;/span&gt; + &lt;span class=&quot;str&quot;&gt;&quot;Congratulation.. ....!!! You read your first gmail email &quot;&lt;/span&gt;); 
}

&lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex) 
{

Response.Write(ex.Message);

}

}
 

    
     &lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/1771242471555229299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/pop3-post-office-protocol-in-aspnet-to.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1771242471555229299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/1771242471555229299'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/pop3-post-office-protocol-in-aspnet-to.html' title='POP3 (Post Office Protocol) in Asp.net to recieve email'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-4874332172982327619</id><published>2010-04-18T22:53:00.000-07:00</published><updated>2010-04-18T23:00:46.361-07:00</updated><title type='text'>Developing on MONO !! its Great!!!!!!!!!!</title><content type='html'>HI all............&lt;br /&gt;&lt;br /&gt;Think about the situation in which we are able to run c# code on Mac and Linux Machines..&lt;br /&gt;Its real now.. We can convert our software developed in C# to run on Linux and Mac Machines..&lt;br /&gt;Me started it too.. and the MONO can help us in doing that..  :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Mono and .NET compile source code into &#39;assemblies&#39;.  Assemblies, which are similar to collections of Java &lt;tt&gt;.class&lt;/tt&gt; files, contain language-independent, platform-independent bytecode called CIL (Common Intermediate Language). Because assemblies are language independent, it doesn&#39;t matter what language was used to create them. Assemblies made with C# can mix with assemblies created with VB.NET, Java (using &lt;a href=&quot;http://www.mono-project.com/Java&quot; title=&quot;Java&quot;&gt; IKVM&lt;/a&gt;), or any language that someone has written a CIL compiler for. &lt;/p&gt;&lt;p&gt;But, being platform independent means, of course, that assemblies need to be compiled &lt;i&gt;again&lt;/i&gt; into native code before they can run on any particular machine. It&#39;s important to distinguish the two compilations involved in Mono applications: from source code to byte code, and from byte code to native machine code. The first compilation is performed by the developer. The second compilation is generally performed just when the program begins executing, on the very computer that will run the application, and for this reason it&#39;s called Just-In-Time (JIT) compilation. This second compilation and the execution of the application is performed by a Common Language Runtime (CLR). &lt;/p&gt;&lt;p&gt;Mono also supports Ahead-Of-Time (AOT) compilation. This is a mode that pre-compiled the code, and it is useful to reduce application startup time (by eliminating the JIT startup time) and increasing the code that can be shared across multiple applications. &lt;/p&gt;On Windows and Linux, as well as other operating systems, assemblies are stored in files with the &lt;tt&gt;.dll&lt;/tt&gt; or &lt;tt&gt;.exe&lt;/tt&gt; extension.  The only difference between a &lt;tt&gt;.dll&lt;/tt&gt; assembly and a  &lt;tt&gt;.exe&lt;/tt&gt; assembly is that a &lt;tt&gt;.exe&lt;/tt&gt; assembly contains a starting point for an application (a Main method), whereas &lt;tt&gt;.dll&lt;/tt&gt; assemblies only are class libraries</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/4874332172982327619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/developing-on-mono-its-great.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/4874332172982327619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/4874332172982327619'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/04/developing-on-mono-its-great.html' title='Developing on MONO !! its Great!!!!!!!!!!'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-5032736694619929049</id><published>2010-01-05T10:23:00.000-08:00</published><updated>2010-04-14T00:08:50.032-07:00</updated><title type='text'>Admin is not Admin in WIndows Vista !!</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/S0OGRpQfZ6I/AAAAAAAAAAs/bbvtbKwjTgA/s1600-h/manifest.bmp&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 125px;&quot; src=&quot;http://3.bp.blogspot.com/__L6As6GvDkY/S0OGRpQfZ6I/AAAAAAAAAAs/bbvtbKwjTgA/s200/manifest.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5423326013975127970&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;The directory access and Write permision using code in Vista is in blocked state. so Project working in Xp will do HELL in vista throwing access exceptions.....&lt;br /&gt;&lt;br /&gt;to over come this add manifest file from project add new item and precombile it thus Avoid that Vista Hell....&lt;br /&gt;So that we are able to pull the Vista UAC .............&lt;br /&gt;&lt;br /&gt;&lt;asmv1:assembly manifestversion=&quot;1.0&quot; xmlns=&quot;urn:schemas-microsoft-com:asm.v1&quot; asmv1=&quot;urn:schemas-microsoft-com:asm.v1&quot; asmv2=&quot;urn:schemas-microsoft-com:asm.v2&quot; xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;assemblyidentity version=&quot;1.0.0.0&quot; name=&quot;MyApplication.app&quot;&gt;&lt;trustinfo xmlns=&quot;urn:schemas-microsoft-com:asm.v2&quot;&gt;&lt;security&gt;&lt;requestedprivileges xmlns=&quot;urn:schemas-microsoft-com:asm.v3&quot;&gt;&lt;requestedexecutionlevel level=&quot;requireAdministrator&quot;&gt;&lt;/requestedexecutionlevel&gt;&lt;/requestedprivileges&gt;&lt;/security&gt;&lt;/trustinfo&gt;&lt;asmv1:assembly manifestversion=&quot;1.0&quot; xmlns=&quot;urn:schemas-microsoft-com:asm.v1&quot; asmv1=&quot;urn:schemas-microsoft-com:asm.v1&quot; asmv2=&quot;urn:schemas-microsoft-com:asm.v2&quot; xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;assemblyidentity version=&quot;1.0.0.0&quot; name=&quot;MyApplication.app&quot;&gt;&lt;trustinfo xmlns=&quot;urn:schemas-microsoft-com:asm.v2&quot;&gt;&lt;security&gt;&lt;requestedprivileges xmlns=&quot;urn:schemas-microsoft-com:asm.v3&quot;&gt;&lt;requestedexecutionlevel level=&quot;requireAdministrator&quot;&gt;&lt;/requestedexecutionlevel&gt;&lt;/requestedprivileges&gt;&lt;/security&gt;&lt;/trustinfo&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;/assemblyidentity&gt;&lt;/asmv1:assembly&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;!--Session data--&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;/assemblyidentity&gt;&lt;/asmv1:assembly&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;!--Session data--&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;!--Session data--&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/5032736694619929049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/01/admin-is-not-admin-in-windows-vista.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5032736694619929049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5032736694619929049'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/01/admin-is-not-admin-in-windows-vista.html' title='Admin is not Admin in WIndows Vista !!'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/__L6As6GvDkY/S0OGRpQfZ6I/AAAAAAAAAAs/bbvtbKwjTgA/s72-c/manifest.bmp" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-2237645440164606465</id><published>2010-01-04T08:32:00.000-08:00</published><updated>2010-01-04T08:34:35.718-08:00</updated><title type='text'>create fullcontrol to a directory for windows machines</title><content type='html'>System.Security.Principal.SecurityIdentifier sid = new System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.WorldSid, null);&lt;br /&gt;            System.Security.Principal.NTAccount acct = sid.Translate(typeof(System.Security.Principal.NTAccount)) as System.Security.Principal.NTAccount;&lt;br /&gt;            string strEveryoneAccount = acct.ToString();&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;            DirectoryInfo dInfo = new DirectoryInfo(Environment.CurrentDirectory + &quot;\\serverservice&quot;);&lt;br /&gt;            DirectorySecurity dSecurity = dInfo.GetAccessControl();&lt;br /&gt;            dSecurity.AddAccessRule(new FileSystemAccessRule(strEveryoneAccount, FileSystemRights.FullControl, AccessControlType.Allow));&lt;br /&gt;&lt;br /&gt;            dInfo.SetAccessControl(dSecurity);&lt;br /&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;!--Session data--&gt;&lt;input onclick=&quot;jsCall();&quot; id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/2237645440164606465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2010/01/create-fullcontrol-to-directory-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/2237645440164606465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/2237645440164606465'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2010/01/create-fullcontrol-to-directory-for.html' title='create fullcontrol to a directory for windows machines'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-5181141744283803951</id><published>2009-12-13T12:29:00.001-08:00</published><updated>2009-12-13T12:33:58.296-08:00</updated><title type='text'>AVOID ASP.net SESSION ERROR..(null reference and others...!)</title><content type='html'>&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt; here goes our session wrapper class.....&lt;br /&gt;&lt;/span&gt;    public static class SessionHandler&lt;br /&gt;   {&lt;br /&gt;    &lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;        private static string _userCountryKey = &quot;UserCountry&quot;;&lt;br /&gt;       &lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;        public static string UserCountry&lt;br /&gt;       {&lt;br /&gt;     &lt;br /&gt;           get&lt;br /&gt;           {&lt;br /&gt;         &lt;br /&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;                /&lt;br /&gt;&lt;/span&gt;                if (HttpContext.Current.Session[SessionHandler._userCountryKey] == null)&lt;br /&gt;               {&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;                  &lt;br /&gt;&lt;/span&gt;                    return string.Empty;&lt;br /&gt;               }&lt;br /&gt;               else&lt;br /&gt;               {&lt;br /&gt;                   return HttpContext.Current.Session[SessionHandler._userCountryKey].ToString();&lt;br /&gt;               }&lt;/span&gt; &lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;            }&lt;br /&gt;         &lt;br /&gt;           set&lt;br /&gt;           {&lt;br /&gt;               HttpContext.Current.Session[SessionHandler._userCountryKey] = value;&lt;br /&gt;           }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;        }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;    }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;here we can set and retrive it ....&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;SessionHandler.&lt;/span&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;UserCountry=&quot;INDIA&quot;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;retrive using&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;Response.Write(&lt;/span&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;SessionHandler.&lt;/span&gt;&lt;span style=&quot;font-family:courier new,courier;&quot;&gt;UserCountry);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Avoid all null references that are eating us ......&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/5181141744283803951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2009/12/avoid-aspnet-session-errornull.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5181141744283803951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/5181141744283803951'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2009/12/avoid-aspnet-session-errornull.html' title='AVOID ASP.net SESSION ERROR..(null reference and others...!)'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9148345414902889873.post-3315455216860402665</id><published>2009-10-04T04:51:00.000-07:00</published><updated>2010-04-18T23:11:07.012-07:00</updated><title type='text'>About  ME!!</title><content type='html'>Me a Software Developer.. From my inside mind i hate this field as this was against my ambition in all means.... But the stringent situation in my life path force me to stick here...&lt;br /&gt;&lt;br /&gt;&quot;Networking is a Dream!! CCIE&quot;&lt;br /&gt; LOL</content><link rel='replies' type='application/atom+xml' href='http://martinkabraham.blogspot.com/feeds/3315455216860402665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://martinkabraham.blogspot.com/2009/10/about-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3315455216860402665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9148345414902889873/posts/default/3315455216860402665'/><link rel='alternate' type='text/html' href='http://martinkabraham.blogspot.com/2009/10/about-me.html' title='About  ME!!'/><author><name>MARTIN K ABRAHAM</name><uri>http://www.blogger.com/profile/10184502173983572201</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB9022M9vg2HH0kXvDVKSQ0hQwah9LFIk77mPgArGsurIcHwap3TMcECWJAH7rv6BmZcip-Y9KBkR9zi2-8PyJjqdb-lsGTxeDl9C-tDIbZiV8IX2WOE69u-hYVTQ8L0/s220/martin.jpg'/></author><thr:total>0</thr:total></entry></feed>