Posts

Showing posts from September, 2014

Adding BitMap on WPF Flow Document

Here is the C# code snippet for adding BitMap on Flow Document of WPF.

System.Windows.Controls.Image testimage = new System.Windows.Controls.Image();

 object o = Properties.Resources.ResourceManager.GetObject("bitmap1");
 Bitmap bm = (Bitmap)o;

 var memoryStream = new MemoryStream();
 bm.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp);
 memoryStream.Position = 0;

var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memoryStream;
bitmapImage.EndInit();

testimage.Source = bitmapImage;
testimage.Stretch = Stretch.None;
testimage.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
 Label lblImageName= new Label();
lblImageName.Content = "bitmap1";

StackPanel sp1 = new StackPanel();
sp1.Children.Add(testimage);
sp1.Children.Add(lblImageName);

dc1.Children.Add(sp1);

BlockUIContainer buc = new BlockUIContainer(dc1);
flowDoc.Blocks.Add(buc);


XAML Code:
            <Grid>
                <FlowDocumentPageViewe…

ASP.NET Page Life cycle

ASP.NET Life cycleAt higer level, this is a two step process -
1. When user sends a request ASP.NET creates an environment which can process the request. Here ASP.NET creates instances of the core objects that will be used to process the requst. This includes HTTPContext, HttpRequest and HttpResponse object.

2. After creating the environment their is a series of events processed by modules, handlers and page objects to process the request.

(I) ASP.NET Environment Creations
1. User sends a request to IIS. IIS first checks which ISAPI (Internet Server Application Programming Interface) extension can server this request. If the request is for an .aspx page then the request will be redirected to ASP.NET (aspnet_isapi.dll) for processing.

2. If this is the first request to the website then a class called as "ApplicationManager" creates a application domian where the website can run.Application domain provides the actual isolation levels so that various website hosted in the same IIS S…