Default.aspx 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <%@ Page Language="C#" AutoEventWireup="true" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <script runat="server">
  4. protected void ScriptManager1_ResolveScriptReference(object sender, ScriptReferenceEventArgs e)
  5. {
  6. if (e.Script.Path.Contains("CustomScript"))
  7. {
  8. if (HttpContext.Current.Request.Url.Host.ToLower() == "www.contoso.com")
  9. {
  10. e.Script.Path = "http://www.contoso.com/ScriptRepository/CustomScript.js";
  11. }
  12. }
  13. }
  14. </script>
  15. <html xmlns="http://www.w3.org/1999/xhtml" >
  16. <head runat="server">
  17. <title>Script Reference Example</title>
  18. </head>
  19. <body>
  20. <form id="form1" runat="server">
  21. <div>
  22. <asp:ScriptManager OnResolveScriptReference="ScriptManager1_ResolveScriptReference" ID="ScriptManager1" runat="server">
  23. <Scripts>
  24. <asp:ScriptReference Path="~/scripts/CustomScript.js" />
  25. </Scripts>
  26. </asp:ScriptManager>
  27. </div>
  28. </form>
  29. </body>
  30. </html>