Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Mar 09, 2011 @ 19:20
    Anthony Candaele
    0

    cannot debug master template

    Hi,

    I implemented a script in my master template to detect language browser settings:

    <script language="C#" runat="server">
            protected void Page_Load(object sender, EventArgs e) {
                    if(Request.UserLanguages != null && Request.ServerVariables["script_name"] == "/") {
                            string language = Request.UserLanguages[0];
                            if(!string.IsNullOrEmpty(language)) {
                                    //Get the culture name - and make sure it's in the RFC 1766 standard <languagecode2>-<country/regioncode2>
                                    //i.e. en-GB, so it's easier to check for
                                    if (language.Length < 3)
                                            language += "-" + language.ToUpper();
                                    //Redirect to the correct page based on language, default to english
                                    switch(language) {
                                            case "en-US":
                                                    Response.Redirect("/home.aspx");
                                                    break;
                                            case "nl-BE":
                                                    Response.Redirect("/startpagina.aspx");
                                                    break;
                                            case "fr-BE":
                                                    Response.Redirect("/accueil.aspx");
                                                    break;
                                            default:
                                                    Response.Redirect("/home.aspx");
                                                    break;
                                    }
                            }
                    }
            }
        </script>          

    for some reason this script is not working, so now I want to debug the script in Visual Studio. As shown in the video on Debugging by Niels Hartvig, I have attached to the w3wp.exe process in Visual Studio, but once I attachted to the process I am not able to step into the breakpoint. I also set the debug=true configuration in the web.config file:

    <compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0">

    Am I overlooking something, or is it not possible to debug a master template in Visual Studio?

    greetings,

    Anthony Candaele
    Belgium

  • Anthony Candaele 1197 posts 2049 karma points
    Mar 09, 2011 @ 19:36
    Anthony Candaele
    0

    found the problem. In 'start options' in visual studio, I needed to change the setting from 'default server' to 'custom server'

Please Sign in or register to post replies

Write your reply to:

Draft