[MVC] Works in Visual Studio, but Listener.Click.Handler doesn't call controller on IIS.

  1. #1

    [MVC] This works in Visual Studio, but Listener.Click.Handler doesn't call controller on IIS.

    I have the following code. Clicking on the "Save" button when running on the Visual Studio server calls the "SaveChanges" function in the HomeController just fine, but nothing happens running the same code on IIS.

    Views/Home/Index.cshtml:
    ...FormPanel()
        .Url("/Home/SaveChanges")
        .BottomBar(bottombar =>{
            bottombar.Add(Html.X().Toolbar()
                .Items(bottombarItems => {
                    bottombarItems.Add(Html.X().Button()
                        .Listeners(listener => {
                            listener.Click.Handler = @"this.up('form').submit();";
                       }))
                }))
        })
    Controllers/HomeController.cs:
    public ActionResult SaveChanges(FormCollection values)
    {
        Debug.WriteLine("save");
        ...
    }
    Last edited by KBorkiewicz; Dec 14, 2012 at 4:21 PM.
  2. #2
    Use Fiddler or FireBug and investigate response from the server
    Please post here text of response
  3. #3
    POST http://10.3.0.80/Home/SaveChanges 404 Not Found
    
    HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable
    
    Most likely causes:
    The directory or file specified does not exist on the Web server.
    The URL contains a typographical error.
    A custom filter or module, such as URLScan, restricts access to the file.
    
    Things you can try:
    Create the content on the Web server.
    Review the browser URL.
    Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus.
    
     This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
    Last edited by geoffrey.mcgill; Dec 14, 2012 at 8:53 PM. Reason: please use [CODE] tags
  4. #4
    It means that you define incorrect url, may be you have ApplicationName under IIS
    Try to use Url.Action to build valid url
  5. #5
    I'm sorry, I don't know what any of that means.

    What do you mean by ApplicationName? How and where should I use Url.Action?

    Quote Originally Posted by Vladimir View Post
    It means that you define incorrect url, may be you have ApplicationName under IIS
    Try to use Url.Action to build valid url
  6. #6
    Quote Originally Posted by KBorkiewicz View Post
    I'm sorry, I don't know what any of that means.

    What do you mean by ApplicationName? How and where should I use Url.Action?
    It means /Home/SaveChanges does not exist. Are you sure you have a Controller class called 'Home' and an action called 'SaveChanges' in that Controller?

    What happens if you just browse to that location?

    Please double check if the Action expects a Post or a Get request, then check using Fiddler if the Form submitted a Post or a Get.
    Geoffrey McGill
    Founder
  7. #7
    I have a controller in a Controllers folder called HomeController.cs, and that has a public method called SaveChanges. It works when I run it on the Visual Studio Development Server, just not IIS.



    Quote Originally Posted by geoffrey.mcgill View Post
    It means /Home/SaveChanges does not exist. Are you sure you have a Controller class called 'Home' and an action called 'SaveChanges' in that Controller?

    What happens if you just browse to that location?

    Please double check if the Action expects a Post or a Get request, then check using Fiddler if the Form submitted a Post or a Get.
  8. #8
    Quote Originally Posted by KBorkiewicz View Post
    I have a controller in a Controllers folder called HomeController.cs, and that has a public method called SaveChanges. It works when I run it on the Visual Studio Development Server, just not IIS.
    Please ensure your Web.config is correct. You should have the following section in your Web.config.

    Example

      <system.webServer>    <staticContent>
          <mimeMap fileExtension=".json" mimeType="application/json" />
          <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
        </staticContent>
        <modules>
          <add name="AnalyticsModule" preCondition="managedHandler" type="Ext.Net.Examples.AnalyticsModule, Ext.Net.Examples" />
          <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </modules>
        <security>
          <authorization>
            <remove users="*" roles="" verbs="" />
            <add accessType="Allow" users="*" verbs="GET,POST,PUT,DELETE" />
          </authorization>
        </security>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
          <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" />
        </handlers>
      </system.webServer>
    You can also cross reference your Web.config with the Sample.Web.config provided in the .zip download package.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] NodeCollection Listener.Click.Handler changes
    By TuscanDev in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 31, 2012, 6:51 PM
  2. [CLOSED] Click listener doesn't exist within Node component
    By Daly_AF in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 06, 2012, 12:21 PM
  3. Visual Studio 2010
    By speddi in forum 1.x Help
    Replies: 2
    Last Post: Oct 11, 2010, 1:42 PM
  4. ASP.NET 2.0 and Visual Studio 2008
    By Mercede in forum 1.x Help
    Replies: 0
    Last Post: Apr 05, 2010, 11:09 AM
  5. click handler doesn't work
    By Kamal in forum 1.x Help
    Replies: 2
    Last Post: Nov 17, 2009, 10:02 AM

Tags for this Thread

Posting Permissions