Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Wednesday, 17 July 2013

Enabling HTTP Handler to render in IE Compatibility mode

HTTP handlers are generally used for download a file, show an image, or even to show a report (ie.. generated as html at runtime and stream it through)

Now consider your html report was generated and now all you need to do is show through your website using ASP.NET http handler. Opening the report html just show all the formatting properly but via http handler some of styles were not correctly applied.

To resolve this you have got 2 options
- Modify your CSS to render it properly
- Force your handler to render in compatibility mode

In order to force your handler to render in compatibility mode all you need is to just add a header

for eg you can force usage of IE8
Response.AddHeader("X-UA-Compatible", "IE=EmulateIE8");


or use microsoft standard. Refer to microsoft article "Specifying legacy document modes"
Response.AddHeader("X-UA-Compatible", "IE=edge");


Be nice to nerds. Chances are you'll end up working for one.
Bill Gates, Microsoft

Wednesday, 10 July 2013

Using Selenium WebDriver to simulate button click for ASP.NET Webforms application that uses DevExpress Controls

First lets create a simple ASP.NET Web application that uses DevExpress controls. I have created a test.aspx page that has got 2 buttons





Code behind (test.aspx.cs)

protected void TestMe_Click(object sender, EventArgs e)
{
  Response.Redirect("success.aspx");
}

protected void TestMe2_Click(object sender, EventArgs e)
{
  Response.Redirect("Fail.aspx");
}


Now here is the snippet of code that can be used to simulate button click
WebDriver driver = new InternetExplorerDriver(@"C:\selenium\selenium-dotnet-2.33.0\IEDriverServer_x64_2.33.0");
driver.Navigate().GoToUrl("http://localhost/test/Test.aspx");
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
var result = js.ExecuteScript("TestMe.click();");
//or
IWebElement btn = driver.FindElement(By.Id("TestMe"));
btn.Click();

Use this Quick Start guide to setup your machine for testing ASP.NET Web applications. For more detailed or complete understanding goto Selenium WebDriver

Nearly all men can stand adversity, but if you want to test a man's character, give him power. Abraham Lincoln
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers