Browser Link and Web Forms (Design mode doesn't work for ASP.NET Web Forms)

1.7k Views Asked by At

I have been playing around with the new Browser Link feature in visual studio 2013. However, I am not able to get the "Design Mode" feature working for "Web Form" pages. It works fine when I am browsing a MVC page. However, as soon as I add a web form to the project, it get an alert in my browser saying that

"Design mode doesn't work for ASP.NET Web Forms".

I can also inspect and refresh the page (from the Browser Link Dashboard).

I tried to debug the JavaScript code injected into the browser to see where it's happening. If you turn your F12 developer on, and search for "Design Mode", you will see it in a js file (the path looks like "/foo/browserlink").

map = browserLink.sourceMapping.getCompleteRange(target);

if (map && map.sourcePath) {
    if (isValidFile(map.sourcePath.toLowerCase())) {
        current = target;
        $(target).addClass(selectedClass);
        browserLink.sourceMapping.selectCompleteRange(current);
    }
    else {
        enableDesignMode(false);
        alert("Design Mode doesn't work for ASP.NET Web Forms");
    }
}

and then the "isValidFile" has the following body

function isValidFile(sourcePath) {
    var exts = [".master", ".aspx", ".ascx"];
    var index = sourcePath.lastIndexOf(".");
    var extension = sourcePath.substring(index);

    for (var i = 0; i < exts.length; i++) {
        if (exts[i] === extension)
            return false;
    }

    return true;
}

How can I get this working for my Web forms application?

1

There are 1 best solutions below

2
On

So the injected javascript is actively looking for web-form based pages (aspx, ascx, master) and firing the alert accordingly. I guess it means exactly what it says!

I couldn't find any additional documentation on this so I tweeted Mads Kvist Kristensen (Web Tools team) for clarification. Not sure if this will be added at a later date? Looks like an awesome feature would love to use it in my web forms app?