Monday, April 29, 2013

ASP.NET Interview Questions: - Show Post Cache substitution?

ASP.NET Interview Questions: - Show Post Cache substitution?:
This is one of the asked ASP.Net Interview Questions during the Interview by the Interviewer.
Post cache substitution is used when we want to cache the whole page but also need some dynamic region inside that cached page. Some examples like QuoteoftheDay, RandomPhotos, and AdRotator etc. are examples where we can implement Post Cache Substitution.
Post-cache substitution can be achieved by two means:

Figure: - “Writesubstitution” in action
You can see we have a static function here “GetDateToString()”. We pass the response substitution callback to the “WriteSubstitution” method. So now, when ASP.NET page framework retrieves the cached page, it automatically triggers your callback method to get the dynamic content. It then inserts your content into the cached HTML of the page. Even if your page has not been cached yet (for example, it's being rendered for the first time), ASP.NET still calls your callback in the same way to get the dynamic content. So you create a method that generates some dynamic content, and by doing so you guarantee that your method is always called, and it’s content is never cached.
Ok the above example was by using “WriteSubstitution” now lets try to see how we can do by using “<>” control. You can get the “<>” control from the editor toolbox.
Figure: - Substitution Control
Figure: - Substitution in Action
Below is a sample code that shows how substitution control works. We have ASPX code at the right hand side and class code at the behind code at the left hand side. We need to provide the method name in the “methodname” attribute of the substitution control.
View following video on Web.config transformation in ASP .Net: -

Learn more on ASP.NET interview questions
Regards,
From more on author’s blog related to ASP.NET interview questions click and visit.

SQL Server Interview Question and answers:- Triggers, Instead of triggers, after triggers, inserted and deleted tables?

SQL Server Interview Question and answers:- Triggers, Instead of triggers, after triggers, inserted and deleted tables?:
Triggers are special kind of stored procedure which have logic's.These logics can be executed after or before data modification happens on a table.There are two types of triggers “Instead of triggers" and "After triggers".

Instead of triggers logic executes prior to data modification while after trigger logic executes after data modification.




In what scenarios will you use instead of trigger and after trigger?

You will use "INSTEAD trigger" to take alternative actions before the update happens.

Some of the uses of instead of trigger's are:-
•Reject updates which are not valid.
•Take some alternative action if any error occurs.
•To implement cascading deletes.For instance you want to delete a customer record.But in order to delete the customer record you also have to delete address records. So you can create a instead of trigger which will first delete the address table before executing delete on customer table.

While "AFTER trigger" is useful when you want to execute trigger logic after the data has been updated.

Some uses of after triggers are:-

•For recording Audit trail where you want new and old values to be inserted in to audit table.
•Updating values after the update has happened.For instance in a sales table if number of products and per product is inserted, you can create an after trigger which will calculate the total sales amount using these two values.

What are inserted and deleted tables?

During triggers we sometimes need old and new values.Insert and deleted tables are temporary tables created by SQL server itself which have new and old values.Inserted tables have one record for newly added data and deleted table has one record of the old version of the data.

So for instance let's say we add a new record called as "Shiv". The inserted table will have "Shiv" and deleted table will have nulls because the record did not exist.Now let’s say some user updates "Shiv" to "Raju".Then inserted table will have "Raju" and deleted tables will have "Shiv".

Also watch my most asked SQL Server interview question video on:- What is the difference between clustered and non-clustered indexes?

Taken from the best selling SQL Server interview question book,you can see more about the book by clicking on  SQL Server interview questions book.

Could not find a part of the path ... bin\roslyn\csc.exe

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added a...