Location javascript files

Last post 11-20-2006 9:12 AM by stimorol. 34 replies.

Sort Posts:

  • Location javascript files

    03-23-2006, 3:59 AM
    • Member
      30 point Member
    • DaBi
    • Member since 01-11-2006, 10:00 AM
    • Netherlands
    • Posts 7

    Hi,

    Is there a way (in the march release) to defer from the standard location of the Atlas Script directory/location  (I think it is getting it now from the resource file of the atlas dll)

    DaBi

  • Re: Location javascript files

    03-23-2006, 4:18 AM
    • Contributor
      5,639 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 963
    • AspNetTeam

    Hi there,

    Since the Atlas script files are now served using WebResources embedded in Microsoft.Web.Atlas.dll, I'm not sure what you mean by getting them from a different location. If you want, you can choose to not use the ScriptManager control and instead just copy the files that were installed to C:\Program Files\Microsoft ASP.NET\Atlas\v2.0.50727\ScriptLibrary into your web application, but then it's up to you to generate the appropriate <script> tags.

    I'd also like to understand what your requirements are so that perhaps we can update ScriptManager to automatically do whatever it is that you need for your application.

    Thanks,

    Eilon

     

    Blog: http://weblogs.asp.net/LeftSlipper/
  • Re: Location javascript files

    03-23-2006, 5:17 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    hello Eilon.

    i'd like to ask you a question related with the way the scripts are packaged. in previous releases, we had free access to the scripts and could easilly debug it. now that is no longer possible due to the way they're packaged.

    to debug the jscript files, i've added the atlas.js file to the project and when i need to see what's going on i add the file to the page as its last file. it seems like this works with IE since it gets into that file when i break into the debugger(though i haven't tried with firefox).

    now, what id' like to know is:
    1. how should we debug the jscript portion of ATLAS? Is there any other approach to do it (besides the one i've described in the previous paragraph)?
    2. since the js files are packaged in the dll, how are we going to solve eventual bugs? for instance, i've reported at leas 4 and it looks like none of them were solved in this release...

    thanks.
    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Location javascript files

    03-23-2006, 9:09 AM
    • Member
      635 point Member
    • Inventisity
    • Member since 03-02-2006, 1:48 PM
    • Posts 129
    I agree with Luis and would this be a possible sollution, not sure if its entirely possible. We will have the scripts at our diposal to debug, alter, change, manipulate but when we compile it, it automatically gets packaged into the dll to take advantage of the compression module and ease of deployment?



  • Re: Location javascript files

    03-23-2006, 12:56 PM
    • Participant
      1,277 point Participant
    • Rama Krishna
    • Member since 01-24-2006, 9:33 PM
    • Atlanta, GA
    • Posts 307

    This can be achieved with little extra effort.

    1. Copy the unpacked script files from the Atlas install directories to the local web directory
    2. Add the following code in the Page_Load handler
        Sub OverrideAtlasScript(ByVal atlasScriptName As String, ByVal newScriptPath As String)
            Dim scriptKey As String = ClientScript.GetWebResourceUrl(ScriptManager1.GetType(), atlasScriptName)
            ClientScript.RegisterClientScriptInclude(scriptKey, newScriptPath)
    
        End Sub
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            OverrideAtlasScript("Atlas.js", "ScriptLibrary/Debug/Atlas.js")
        End Sub
    

    This is an hack and it works. The code should not be used for production.

  • Re: Location javascript files

    03-23-2006, 2:22 PM
    • Member
      635 point Member
    • Inventisity
    • Member since 03-02-2006, 1:48 PM
    • Posts 129
    Great Hack Rama :)

    For those that wants it in C#:

        protected void Page_Load(object sender, EventArgs e)
        {
            OverrideAtlasScript("Atlas.js", "ScriptLibrary/Atlas.js");
        }

        public void OverrideAtlasScript(String atlasScriptName, String newScriptPath){
            String scriptKey  = ClientScript.GetWebResourceUrl(ScriptManager.GetType(), atlasScriptName);
            ClientScript.RegisterClientScriptInclude(scriptKey, newScriptPath);
        }

    Bolded are the elements that you might need to change :)


    However, when in the Script Explorer, both the Atlas.js in the ScriptLibrary, and the Atlas.js in the DLL is loaded it seems.

  • Re: Location javascript files

    03-24-2006, 3:09 PM
    • Contributor
      5,639 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 963
    • AspNetTeam

    Hi everyone,

    You shouldn't really have to do any of this - you can just open Script Explorer in VS after you attach the debugger to iexplore.exe. Just double-click the WebResource.axd (there might be more than one) and set a breakpoint anywhere you want.

    The only thing that makes this a bit tricky is that sometimes you encounter a bug in VS that when you double click on a WebResource it won't open. If that happens, close all open script windows, then open the ASPX in Script Explorer, and then open the WebResource.

    Thanks,

    Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
  • Re: Location javascript files

    03-24-2006, 3:18 PM
    • Participant
      1,277 point Participant
    • Rama Krishna
    • Member since 01-24-2006, 9:33 PM
    • Atlanta, GA
    • Posts 307
    Yes this works but setting a breakpoint in anonymous functions in Atlas library from VS.NET deosnot work. So I have to use the debugger statement in the Atlas code. Till January CTP it was easy but now since everything is a web resource it is not possibel to add the debugger statement.
  • Re: Location javascript files

    03-24-2006, 3:52 PM
    • Member
      344 point Member
    • kevindente
    • Member since 12-05-2003, 4:27 PM
    • Posts 75
    Eilon,
    Thanks for the pointer that bug - I've definitively been encountering it, but hadn't figured out the reliable workaround yet. Hope that one gets fixed in SP1.

    While it's true that you can do some amount of breakpointing and debugging that way, it has some major limitations. For example, the breakpoints don't even survive a page refresh, never mind an app restart. When doing lots of debugging, this gets pretty old pretty fast.

    Something like a simple "ScriptLibraryPath" property on the ScriptManager (which if not set would fall back to using the embedded resources) would make things a lot easier for us, both for debugging and bug-fixing during the CTP process. Another alternative would be a web.config setting (that's the trick that I used doing some heavy Ajax stuff a couple years ago), or even making GetFrameworkScriptPath protected and overrideable.




  • Re: Location javascript files

    03-25-2006, 10:48 AM
    • Member
      635 point Member
    • Inventisity
    • Member since 03-02-2006, 1:48 PM
    • Posts 129
    I think that was the frustrating part of just using the web resource debugging technique, not being able to survive a page refresh so everytime you have to reset the breakpoint.

    For the time being I like Rama's way, just so you actually have the file to set breakpoints + do a bit of modification to the library if/when necessary :)

  • Re: Location javascript files

    03-27-2006, 12:38 AM
    • Member
      30 point Member
    • DaBi
    • Member since 01-11-2006, 10:00 AM
    • Netherlands
    • Posts 7

    Hi thanks for the nice post...

    Unfortunatly it won't work in our situation. We want to replace the atlas.js scriptfile but the scriptmanager not renders both the original script in the resourcefile and the replacement atlas.js file. The browser still uses the original script.

    We have 2 reasons for wanting this:

    1. In the case of bugs in the script file we want to be able to fix these bugs so we won't have to wait for the next release to fix this.
    2. We have added some functionaltity for influencing the postback behaveour of the updatepanel. Sometimes we want a 'normal' postback and repaint of the page for some complex pages.

    Is there any way to get back the solution for the location of the javascript that was used in the december release where you could simply set this in the web.config? This does not have to be default behavour but some customization would be nice...

  • Re: Location javascript files

    04-05-2006, 11:32 AM
    • Member
      5 point Member
    • sudhakarmuthu
    • Member since 04-05-2006, 3:27 PM
    • Posts 1

    HI,

    i am using javascript in my application which is running internet exploer . i am getting the following exception "

    A debugger break at "jScript - anonymous"could not be handeled because the source could not be found. check the class path in the debug option dialog. the application will continue

    "

    can any one help me out in this?

    thanks in advance

    sudhakar

  • Re: Location javascript files

    04-05-2006, 2:47 PM
    • Contributor
      5,639 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 963
    • AspNetTeam

    Hi DaBi - I opened a bug to track your requests to make debugging easier.

    Sudhakar - please follow the instructions mentioned earlier in this post to see how to debug Atlas scripts.

    Thanks,

    Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
  • Re: Location javascript files

    04-06-2006, 12:52 AM
    • Member
      30 point Member
    • DaBi
    • Member since 01-11-2006, 10:00 AM
    • Netherlands
    • Posts 7

    Hi Eilon... thanks

    What is the description of the bug you just opened? Is there a web site where I can report findings/bugs?

    Is it allready decided when the next relase will be?

    Thanks

    DaBi

  • Re: Location javascript files

    04-06-2006, 1:58 PM
    • Contributor
      5,639 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 963
    • AspNetTeam

    Hi DaBi,

    The bug I opened is a rather general one to make debugging Atlas a lot easier. We are working on having an MSDN Feedback Center for Atlas, but I don't think it's up yet.

    We are actively working on the next CTP, but we don't have a specific date. Our CTPs come out about every 4 - 6 weeks. The debugging issue will not be fixed for the next CTP, however.

    Thanks,

    Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
Page 1 of 3 (35 items) 1 2 3 Next >