問題 sys未被定義之奇怪現象

  • 2007年12月8日 上午 03:15
     
     

    Dear All:

    狀況發生如下,我把有用到Control ToolKit的網頁放到IIS(別台主機)上,Web.config該有的tag我都放了,然後用我的電腦開瀏覽器連過去,是正常的,接著用別台的電腦連同1個網址,卻出現sys未被定義的錯誤,目前測到的結果是只有我的是正常的,其他電腦連過去卻都會顯示sys未被定義,明明放的IIS並非我自己本機的電腦而是別台主機的,用不同的Client連過去卻只有我的才可以正常執行,在本論壇搜尋了一下,發現在以下討論串

    http://forums.microsoft.com/msdn-cht/ShowPost.aspx?PostID=943873&SiteID=14

    裡的TerryChuang與小魯跟我有同樣的狀況,不過小魯說的解法似乎是要主機也灌VS 2005,請問還有其他的解法嗎,畢竟我並不想在主機灌VS 2005(主機當然是越乾淨越好囉),而且這情況也不清楚是Client端的問題還是Server端的問題,本來以為是Client的問題,後來把Client端的IE版本跟安全性設定都弄成跟我的電腦一樣也是不行,希望有經驗的人可以分享一下

    感謝~

所有回覆

  • 2007年12月8日 上午 03:26
     
     

    Sys 未被定義通常都是 ScriptManager 未被宣告在頁面最上面,如果你有用 MasterPage 也可以將 ScriptManager 定義在 MasterPage 的最上面即可。

     

    你檢查一下:

    1. 你主機有安裝 ASP.NET AJAX Extension 1.0 套件嗎?

    2. 你頁面中有加入 ScriptManager 嗎?

     

    ----
    From: Will
    Blog: http://blog.miniasp.com/
    記載著 Will 在網路世界的學習心得與技術分享

     

  • 2007年12月8日 上午 08:21
     
     

    感謝回覆,關於以上2點都有,現在的問題點是我用我的IE連過去是正常的,用別台電腦的IE連過去是不正常的

  • 2007年12月8日 上午 09:35
    版主
     
     

    請參考下列連結的解法(之前我開發系統也遇到相關問題,是用下列方法解決):

    http://www.xker.com/page/e2007/0115/9603.html

     

  • 2007年12月10日 上午 03:27
     
     

    感謝LOLOTA回覆,我照你給我的網址將

    程式碼區塊

    <location path="ScriptResource.axd">
     <system.web>
      <authorization>
       <allow users="*"/>
      </authorization>
     </system.web>
    </location>

     

    貼到我的Web.config還是不行,不過現在是連我自己的電腦連過去也不行了

    完整Web.config如下:

     

    程式碼區塊

    <?xml version="1.0"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
     <configSections>
      <sectionGroup'>http://schemas.microsoft.com/.NetConfiguration/v2.0">http://schemas.microsoft.com/.NetConfiguration/v2.0">
     <configSections>
      <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
       </sectionGroup>
      </sectionGroup>
     </configSections>
     <system.web>
      <customErrors mode="Off" />
      <pages>
       <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       </controls>
      </pages>
      <!--
              Set compilation debug="true" to insert debugging
              symbols into the compiled page. Because this
              affects performance, set this value to true only
              during development.
        -->
     <authorization>
                    <allow users="*"/>
                </authorization>
      <compilation debug="true">
       <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       </assemblies>
      </compilation>
       <httpHandlers>
          <remove verb="*" path="*.asmx"/>
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
        </httpHandlers>
      <httpModules>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </httpModules>
     </system.web>
     <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
      <modules>
       <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </modules>
      <handlers>
       <remove name="WebServiceHandlerFactory-Integrated"/>
       <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </handlers>
     </system.webServer>
     <appSettings>
      <add key="ConnectString" value="server=192.168.12.104\Production;uid=develop;pwd=develop;database=P0A1_DEV"/>
      <add key="ConnectString_Comp" value="Data Source=192.168.12.14\D0A2DB;DataBase=Common_IT;User ID=webuser;Password=aurorajag"/>
     </appSettings>
    <location path="ScriptResource.axd">
            <system.web>
                <authorization>
                    <allow users="*"/>
                </authorization>
            </system.web>
        </location>
    </configuration>

    我也在該台主機上灌了VS 2005,似乎也沒效呢,請問還有其他的解法嗎?

  • 2007年12月10日 上午 06:05
     
     
    不知道你有沒有試過將瀏覽器的暫存檔清空試試.
    之前也有遇過"sys"的訊息.
    後來發現是因為javascript一直是cache舊的.

  • 2007年12月10日 上午 06:27
     
     

    感謝回覆,我有把Global裡面的某段程式註解掉就可以了,不過這段程式是屬於一定要執行的˙˙˙完整Global.asax.cs如下:

    程式碼區塊

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.Security;
    namespace A0A2
    {
     /// <summary>
     /// Global 的摘要描述。
     /// </summary>
     public class Global : System.Web.HttpApplication
     {
      public Global()
      {
       InitializeComponent();
      } 
      
      protected void Application_Start(Object sender, EventArgs e)
      {

      }
     
      protected void Session_Start(Object sender, EventArgs e)
      {
       Session["Language"]="1";
      }

      protected void Application_BeginRequest(Object sender, EventArgs e)
      {

      }

      protected void Application_EndRequest(Object sender, EventArgs e)
      {

      }

      protected void Application_AuthenticateRequest(Object sender, EventArgs e)
      {
       
       
      }
      private void Global_AcquireRequestState(object sender, System.EventArgs e)
      {

                //把這段註解掉就可以了,此段的功能是強制使用者依定要輸入帳密,一定要執行
                //if (Request.Path.IndexOf(".asmx") != -1) return;
                //Session["aa"] = Request.Path.ToString();
                //if ((string)Session["EMPNO"] == null)
                //{
                //    if (!Request.Path.EndsWith("loginP.aspx"))
                //    {
                //        Response.Redirect(Request.ApplicationPath + "/loginP.aspx");
                //        Response.End();
                //    }
                //}

      }
      protected void Application_Error(Object sender, EventArgs e)
      {

      }

      protected void Session_End(Object sender, EventArgs e)
      {

      }

      protected void Application_End(Object sender, EventArgs e)
      {

      }
       
      #region Web Form Designer generated code
      /// <summary>
      /// 此為設計工具支援所必需的方法 - 請勿使用程式碼編輯器修改
      /// 這個方法的內容。
      /// </summary>
      private void InitializeComponent()
      {   
       this.AcquireRequestState += new
        System.EventHandler(this.Global_AcquireRequestState);

      }
      #endregion
     }
    }

     

    還有這個Global是從.NET 1.1升級過來的,不知道有沒有影響
  • 2007年12月10日 上午 07:42
    版主
     
     

    剛剛找了一下你的web.config,沒有發現<authentication mode="Forms" />這一段

    這一段不是設定要以哪種方式驗證, 還是你是使用custom的方式?

     

     

  • 2007年12月11日 上午 01:44
     
     

    感謝回覆,預設Web.config好像沒有使用authentication,不過我有把<authentication mode="Forms" />加入<system.web>...</system.web>還是不行,今天再測還是把Global.aspx那段拿掉才行,可是那段語法怎麼看好像都不是跟它有關˙˙˙
    對了,authentication是跟登入控制項有關吧,我們是自己寫登入的功能所以不用應該沒關係吧

  • 2007年12月11日 上午 05:59
     
     

    我發現只要使用Session就會出現這個現象,這位似乎也有跟我相似的問題

    http://forums.asp.net/t/1039289.aspx

    不過也是沒解答