Skip to main content

Posts

Showing posts from April, 2012

Fixing Error when build a page/project is Visual Studio 2010

I has getting the following error every time I build the my page or project in Visual Studio Express 2012.
Error 78 (0): error CS1703: An assembly with the same identity 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, has already been imported.

To fix it I goggled all over eventually I figured this out:

In Solution Explorer right click on the root of the project then click "Property Pages" (or Shift+F4)

Then it will display something like this:

Select the assembly that is giving problems and then click "Remove"

;) Problems solved.

Redirecting you page to a mobile ready page

There are a number of solutions on the internet but the one I found to work, is here
51Degrees.mobi - Mobile Device Detection and Redirection

The is the code: I allow the user to click on a button that redirects back to the proper page, using PostURL with a Parameter


  protected void Page_Load(object sender, EventArgs e)
  {
    string _strUserAgent = Request.UserAgent.ToString().ToLower();


    if ((Request.Browser.IsMobileDevice == true) || _strUserAgent.Contains("iphone") || _strUserAgent.Contains("blackberry") ||           _strUserAgent.Contains("mobile") || _strUserAgent.Contains("windows ce") || _strUserAgent.Contains("opera mini") ||
           _strUserAgent.Contains("palm"))
      {
        if (Request.Params["ForceStandard"] != "Y")
         Response.Redirect("mobiProducts.aspx");
        // show a status message
        _strUserAgent = "mobile detected";
      }
    // update some status on…