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

<channel>
	<title>Angel Tankov Blog</title>
	<atom:link href="http://angeltankov.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://angeltankov.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 13 Mar 2007 12:48:10 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='angeltankov.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/f1e0d06fd0070d1c7344f2bd097262f4?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Angel Tankov Blog</title>
		<link>http://angeltankov.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://angeltankov.wordpress.com/osd.xml" title="Angel Tankov Blog" />
		<item>
		<title>Using .NET Code Access Security(CAS)</title>
		<link>http://angeltankov.wordpress.com/2007/03/13/using-net-code-access-securitycas/</link>
		<comments>http://angeltankov.wordpress.com/2007/03/13/using-net-code-access-securitycas/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 12:48:10 +0000</pubDate>
		<dc:creator>angeltankov</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://angeltankov.wordpress.com/2007/03/13/using-net-code-access-securitycas/</guid>
		<description><![CDATA[The Common Language Runtime allows to perform only operation which the code is permitted to execute. This is to prevent unauthorized access to protected resources or just to protect code.  That is why  we  use Code Access Security. Using it we can restrict our code for performing some kinds of operation and/or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=8&subd=angeltankov&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The Common Language Runtime allows to perform only operation which the code is permitted to execute. This is to prevent unauthorized access to protected resources or just to protect code.  That is why  we  use Code Access Security. Using it we can restrict our code for performing some kinds of operation and/or restrict other code to perform operations.  For this we can use permission sets &#8211; collection of permissions.  The permission an be : <em>Full Trust, Local Intranet, Internet, Execution</em> and <em>Nothing</em></p>
<ul>
<li>Full Trust means that code can be executed on every system which can access this code. This means that code is unrestricted.</li>
<li>Local Intranet &#8211; its code can be executed from machines which can execute code over the same LAN</li>
<li>Internet &#8211; Internet restriction for executing this code</li>
<li>Execution  &#8211; this code can only be run but the remote process can not access the resources</li>
<li>Nothing &#8211; this code can not be executed even from the our machine.</li>
</ul>
<p>Permission set can include more than one of this permissions except <em>Full Thrust</em>  because it include all of other. .NET Configuration Tool allows to create other permissions.</p>
<p>Security <em>Policy  </em>is configurable set of rules that the CLR uses to determine the permission level to grant to code. It can be <em>Enterprise, Machine, User</em> and <em>Application Domain</em> . These levels are independent each of other and marks the level on which the code can be used.</p>
<p>Here are some code snippets which we van use when we need to use <em>Code Access Security : </em></p>
<p>How tho get the permission set of the current machine pragmatically. First wee need to define the policy level on which we need to get permission set. We can use <em>System.Security.SecurityManager</em> class.</p>
<p>IEnumerator policyEnumerator = SecurityManager.PolicyHierarchy();</p>
<p><em>while(policyEnumerator.MoveNext())<br />
{<br />
PolicyLevel currentLevel = (PolicyLevel)policyEnumerator.Current;<br />
if(currentLevel.Label == &#8220;Machine&#8221;)<br />
{<br />
// Iterate through the permission sets at the Machine level.<br />
IList namedPermissions = currentLevel.NamedPermissionSets;<br />
IEnumerator namedPermission = namedPermissions.GetEnumerator();<br />
// Locate the named permission set.<br />
while(namedPermission.MoveNext())<br />
{</em></p>
<p><em>                // Write permission set in console<br />
</em></p>
<p><em>            Console.WriteLine(((NamedPermissionSet)namedPermission.Current).Name);<br />
}<br />
}<br />
} </em></p>
<p>How we can set permission pragmatically</p>
<p><em>PermissionSet ps = new PermissionSet(PermissionState.None);<br />
ps.AddPermission(new FileIOPermission(<br />
FileIOPermissionAccess.Read | FileIOPermissionAccess.Write ,&#8221;C:\\MyFile.txt&#8221;));</em></p>
<p>these are the basic principles of Code Access Security.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/angeltankov.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/angeltankov.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/angeltankov.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/angeltankov.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/angeltankov.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/angeltankov.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/angeltankov.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/angeltankov.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/angeltankov.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/angeltankov.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/angeltankov.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/angeltankov.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=8&subd=angeltankov&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://angeltankov.wordpress.com/2007/03/13/using-net-code-access-securitycas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/014ee9652d5c9f0d41d72c8001c69383?s=96&#38;d=identicon" medium="image">
			<media:title type="html">angeltankov</media:title>
		</media:content>
	</item>
		<item>
		<title>The principle of .NET Remoting</title>
		<link>http://angeltankov.wordpress.com/2007/03/01/the-principle-of-net-remoting/</link>
		<comments>http://angeltankov.wordpress.com/2007/03/01/the-principle-of-net-remoting/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 09:51:37 +0000</pubDate>
		<dc:creator>angeltankov</dc:creator>
				<category><![CDATA[Remoting]]></category>

		<guid isPermaLink="false">http://angeltankov.wordpress.com/2007/03/01/the-principle-of-net-remoting/</guid>
		<description><![CDATA[    Remoting is mechanism for communication between two and more applications. This technology is successor of DCOM in the past but Remoting is universal, secure and more flexible. It is possible to exchange data between two prats of one application isolated in separate ApplicationDomains.  In .NET every process is strarted in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=5&subd=angeltankov&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>    Remoting is mechanism for communication between two and more applications. This technology is successor of DCOM in the past but Remoting is universal, secure and more flexible. It is possible to exchange data between two prats of one application isolated in separate <em>ApplicationDomains</em>.  In .NET every process is strarted in its own <em>ApplicationDomain </em>but it is possible to separate more <em>ApplicationDomains </em>in one process and vice versa. This organisation is used in IIS where many web applications  are started in one process <em>aspnet_wp</em> but can be manipulated independently each other. This is because every  web application has his own <em>ApplicationDomain </em>and it keeps it isolated from other web sites.</p>
<p>This technology is organised by communication via channels. There are 3 types of channels TcpChannel, HttpChannel and SoapChannel. The type of channel depends on  the the network, application type &#8230; The main principle is that a specific instance of class inherits <font face="Verdana, Arial, Helvetica" size="-1"><em>MarshalByRefObject</em> </font>class is created in ApplicationDomain of the application(Server) which has the specific data and this object can be accessed from the application which need the data(Client)  via created channel.</p>
<p>In some cases it is possible replace Remoting with WebServices and this is because it is  mechanism similar to WebServices but there are some big differences and in some cases Remoting is the only possible way to do something</p>
<ul>
<li> Web services can be accessed only with HTTP protocol Remoting can be across any protocols</li>
<li> Web services works is  stateless mod. Each time when client  needs service results in new object in web service but in Remoting one object can be used by many requests from one client</li>
<li>Web services serialized objects through XML .NET Remoting relies on existing of CLR assemblies and contain information about types</li>
<li>Web services can be used from applications build on different types of technologies Remoting requires .NET</li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/angeltankov.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/angeltankov.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/angeltankov.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/angeltankov.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/angeltankov.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/angeltankov.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/angeltankov.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/angeltankov.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/angeltankov.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/angeltankov.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/angeltankov.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/angeltankov.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=5&subd=angeltankov&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://angeltankov.wordpress.com/2007/03/01/the-principle-of-net-remoting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/014ee9652d5c9f0d41d72c8001c69383?s=96&#38;d=identicon" medium="image">
			<media:title type="html">angeltankov</media:title>
		</media:content>
	</item>
		<item>
		<title>How to process Gif image with GDI+ and .NET</title>
		<link>http://angeltankov.wordpress.com/2007/02/27/how-to-handle-gif-image-with-gdi/</link>
		<comments>http://angeltankov.wordpress.com/2007/02/27/how-to-handle-gif-image-with-gdi/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 12:33:33 +0000</pubDate>
		<dc:creator>angeltankov</dc:creator>
				<category><![CDATA[Image Processing]]></category>

		<guid isPermaLink="false">http://angeltankov.wordpress.com/2007/02/27/how-to-handle-gif-image-with-gdi/</guid>
		<description><![CDATA[Working with images in .NET  is easy process  especially  when using GDI+ . For this purposes we need to include   System.Drawing namespace. and use Image,Bitmap and Graphics classes. This is ok with jpeg, png, bmp &#8230; but it is not so easy to manipulate gif images. This is because gifs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=3&subd=angeltankov&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Working with images in .NET  is easy process  especially  when using GDI+ . For this purposes we need to include   System.Drawing namespace. and use <span style="font-style:italic;">Image</span>,<span style="font-style:italic;">Bitmap </span>and <span style="font-style:italic;">Graphics </span>classes. This is ok with jpeg, png, bmp &#8230; but it is not so easy to manipulate gif images. This is because gifs are indexed pixels and when try to save image to file it is saved with 8 bit per pixels compression. This makes the image which is just saved to looks bad.  One way to pass over this issue is as follows:</p>
<ol>
<li>Get width and height of the original picture</li>
<li>Create a bitmap object in code with width and height just like original image and max resolution( 64 bpp )</li>
<li>Create <em>Graphics object </em>with this non-indexed image</li>
<li>Set Compositing<span style="font-style:italic;">Quality</span> as high on graphics object</li>
<li>Load original gif image as unscaled image in graphics object</li>
</ol>
<p><em>Bitmap oNonIndexec = new Bitmap(nWidth, nHeight, PixelFormat.Format64bppPArgb);<br />
oNonIndexec.SetResolution(nWidth, nHeight);<br />
Graphics oGraphics = Graphics.FromImage(oNonIndexec);<br />
oGraphics.CompositingQuality = CompositingQuality.HighQuality;<br />
oGraphics.DrawImageUnscaled(oImage, 0, 0);</em></p>
<p>This keeps quality as high as possible when processing gifs</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/angeltankov.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/angeltankov.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/angeltankov.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/angeltankov.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/angeltankov.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/angeltankov.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/angeltankov.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/angeltankov.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/angeltankov.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/angeltankov.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/angeltankov.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/angeltankov.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=angeltankov.wordpress.com&blog=822773&post=3&subd=angeltankov&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://angeltankov.wordpress.com/2007/02/27/how-to-handle-gif-image-with-gdi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/014ee9652d5c9f0d41d72c8001c69383?s=96&#38;d=identicon" medium="image">
			<media:title type="html">angeltankov</media:title>
		</media:content>
	</item>
	</channel>
</rss>