I bet! You might have came across this error, at least once in your development, while playing with master pages.
Error creating control
Response is not available in this context
But still, the page will render during runtime, without any issues.
I came across this error last night. Though, I have been seeing this error for a last few years, I clearly don’t have an idea what’s exactly the reason for this design-break. But, now I know, Why it’s behaving so!
Here goes the reason. All my content pages are inheriting a base class. One of the functionality of base class is to check for authorized users in the OnInit event of the webpage.
Now, what was the reason for the error?
Read the error message carefully – “Response is not available in this context”. Say it again, “Response is ….”. Now, check the above code again.
Inside the if statement, I’ve a Response.Redirect. In designer mode, Response is simply null because I haven’t executed my webpage yet and does not have any value.
Workaround? Yes, simply include a null check!
Now, rebuilt your website and check the design-mode.
Viola! That’s all.
Please note, objects like Session will also cause this problem because their value won’t be available in design-mode (read more).
Hope this helped.
In traditional desktop based development, we only bothered about keyboards for accepting input. With smartphones, things are slighlty differenet. Other than keyboard inputs, smartphones has a set of sensors that takes the user-experience (UX) in different level. Last day, I downloaded a bike racing game from Windows Marketplace, where you need to move the bike left and right, by simply tilting the phone to left and right. Cool isn't it?
Windows Phone supports a set of sensors and they allows you to take UX to next level and they are as below:
Heard about tombstoning? The finishing manuere of WWE Legend Undertaker? Oh, yes! I’m love WWE universe. But, I’m not talking about WWE. In fact, it’s all about Windows Phone (WP) application life-cycle while multi-tasking.
In multi-tasking, Windows Phone uses a different approach for the application life-cycle. WP allows applications to be paused, made dormant and suspend without alerting the user that the application is being paused. It does this by notifying the application when it is being paused; then the application is also notified when it is to resume running. In the pause and resume states, the application is given a chance to save and load data to give the user the impression that the application is never stopped.
And this, application life-cycle in WP is called Tombstoning.
For those who are new to development, trust me - Windows Phone is not a device, it’s a Platform.