I'm working on getting a new MVC 3.0 application up and running on a Windows 2008 server, running SQL05 and IIS7 with ASP.NET Framwork 4.0 as well as MVC installed. The index page has two select boxes. Selecting an option in the first select box does an ajax call to my controller that populatest the second select box. This works just fine on my winxp dev machine but returns a 404 on the call to the controller when running
on the server. Code for that call:
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm("CamperDirectory", "TradingPost")) { %>
Select a Season: <%: Html.DropDownListFor(x => x.SelectedSeason, new SelectList(Model.GetSeasons, "Value", "Text"),"Please select a Season.") %><br /><br />
<%: Html.ValidationMessageFor(model => model.SelectedSeason)%>
Select a Session: <%: Html.DropDownListFor(y => y.SelectedSession, new SelectList(Model.GetSessions, "Value", "Text"), "Please select a Summercamp Session.") %>
<%: Html.ValidationMessageFor(model => model.SelectedSession)%>
<input type="submit" value="Go" />
<% } %>
</asp:Content>
<asp:content ID="Content3" contentplaceholderid="HeadContent" runat="server">
<script language="javascript" type="text/javascript">...............................
i would like to call an HttpGet GetEvents(Datetime dateSelected) controller action each time the user cliks on a date in jquery ui datepicker. I handle the onSelect datepicker event in order to call GetEvents() and refresh the Events page with the events for the selected date. The $.ajax method i use from jquery hits the GetEvents action, but instead of refreshing the page (and the url), i get an ajax result back.
[Code]....
So, how could i just call the HttpGet GetEvents() controller action via jquery, without the use of ajax in order to refresh the page?
i have a website where i provicde a link. On clicking the link a controller action method is called to generate a zip file after creation of zip file is done, i show the link to download the zip file by replacing the link to create a zip with the link to download the zip.
the problem is that after zip file creation is over and link is shown, when user clicks on the link to download the zip file, they are sent to login. After providing correct credentials in the login page they are prompted to download the zip file. they sould not be sent to the login page. In the action to generate zip file i haven't abondoned the session or haven't not done anything that abondons the session.
the user should not be sen't to login page after successful creation of zip file user should be able to download the file without login. i search internet on this problem, but i did not find any solution. In one of the blog written by hanselman i found this statement that creates the problem with the session: Is some other thing like an Ajax call or IE's Content Advisor simultaneously hitting the default page or login page and causing a race condition that calls Session.Abandon? (It's happened before!)
so i thought there might be some problem with ajax call that causes the session to expire, but i don't know what is happening? it's like this after users click on the link to create zip file the zip file is created successfully but the session gets expired. this is not what i want. Why does the session has to get expired after making a jquery post call to controller action to create a zip file? i hope u understand the problem.
I can't figure out why I might be getting this error. It happens on an ajax call.This is the full error text:
-- 6/21/2010 6:09:10 PM -- System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): OutputStream is not available when a custom TextWriter is used. at System.Web.HttpResponse.get_OutputStream() at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context) in C:AjaxBuildAjaxServerAjaxControlToolkitToolkitScriptManagerToolkitScriptManager.cs:line 286 at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e) in C:AjaxBuildAjaxServerAjaxControlToolkitToolkitScriptManagerToolkitScriptManager.cs:line 246 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context).......................
My jQuery ajax call is failing with an undefined error. My js code looks like this:
[Code]....
My ajax source is a generic ASP.NET handler:
[Code]....
Now, if I return an empty object ("{ }") in my handler, the call will succeed. But when I return any other JSON object, the call fails.
The dataFilter handler shows that I am receiving a correct object. Firebug shows the response as expected, and the JSON tab shows that the object is parsed correctly.
So what could be the cause?
[Edit] I should have actually written "when I return any invalid JSON object, the call fails"! :D
I have one problem with actionlink. My Example is: i have one view and controller named as XYZ.aspx and XYZ.vb controller , in this view i put below line
<%=Html.ActionLink("Manage", "Index", "Advertisement", New With {.aintCampaignid = Cam.CampaignID})%>
I have another view and controller named as Index.aspx and Advertisement.vb if click on manage link in XYZ view it will call to advertisement controller and index function But iam getting [URL], it wont call ..
application has a main controller which gets some requests that should be filtered first. This main controller decides which other controller should handle the request.The redirection is usually possible with RedirectToAction(..). But using this method causes a round trip and changes the original called url. This behaviour is not wanted. The url should e left as it was in the origin request.Is this possible? If yes - how?If i instanciate a controller myself (simple call of new MyConstructor()) and call the wanted action then this controller runs in the wrong context and the views won't be found.
I have an asp.net MVC2 application that needs to call a web service from the controller. How do I do this? It is a RESTful service that returns Json data.
Can I call a webservice from a Controller Action in ASP.Net MVC?
public ActionResult Index() { PersonObject person = new Person("Sam"); //Call a webservice which is located in the same app under /Services/General.asmx/WebMethod and pass it person }
I am making a JSON call to web method which is defined in code behind. The web method returns a class object.The class returns 3 properties one of type list and 2 integers. I am accessing these in the following manner:
success: function(result) { alert(result); alert(result.LookCount); alert(result.length); if(result.LookCount > 0) { var Info = ""; for(var i = 0;i < result.LookUps.length; i++) { Info += CreateLookUpGrid(result.LookUps[i].Client,result.LookUps[i].ClientOrg); }
alert(result.LookCount) -> alerts undefined and when i alert result it shows me the compelte result string which has all data. So the data is returned correctly by web method. But I am unable to access it.
I have one problem with actionlink. My Example is: i have one view(xyz.aspx) and controller(abc.vb) , in this view i put below line
<%=Html.ActionLink("Manage", "Index", "Advertisement", New With {.aintCampaignid = Cam.CampaignID})%>
I have another view(Index.aspx) and controller(Advertisement.vb) if click on manage link in XYZ view it will call to advertisement controller and index function But iam getting [URL] it wont call.
I did some service operation in mywcfdataservice.svc Now I have to use the service operation in my controller but I don't find them.I can use:
Entities2Voice context = new Entities2Voice();
and so I can read the table of my db, but I didn't find the way to see sevice operation.I have my model.edmx to use sql db and the code in mywcfdataservice.svc works right. I can call the service operations from my browser and they work.I try to add service reference to my .svc file, to use it as a service, but when I press ok button after some seconds, I take an error (is in Italian):Il documento HTML non contiene informazioni per l'individuazione del servizio Web.I metadati contengono un riferimento che non può essere risolto: 'http://localhost:2873/WcfDataService2Voice.svc'.Il tipo di contenuto text/html; charset=utf-8 del messaggio di risposta non corrisponde al tipo di contenuto del binding (application/soap+xml; charset=utf-8). Se si utilizza un codificatore standard, verificare che il metodo IsContentTypeSupported sia implementato correttamente. I primi 1024 byte della risposta erano: '
As I call the Controller to exit the focus of my textbox? I need to exit the textbox, go to the database to get information that will supplement the information from my form.
I have a mvc controller that communicates with a we service for user authentication, when user clicks login button, onclick event makes a call to javascript function using ajax and it makes a call to an action in server.The problem is when a use fiddler tool shows ajax call to the controller and also web service call, web service is called from controller never javascrit, how I can protect visibility of web service calling?, using web forms with the same scenario never shows a web service call.
This is probably something simple. The following JQuery call is executing and calling the controller. The controller is executing correctly. I used the sample data that's commented out to verify that the templates were working also. However, the success function is not executing in the browser. Any thoughts or other ways I can debug this?
Also I have a dropdownlist, how do I call the controller's action after I click the "Submit" button?
And how do I pass the Model back to the controller action as well?
The reason I want to pass back the model (or other object/class) to controller's action is I might have 5 dropdown lists and 3 edit boxes values to be sent as parameters. So I would like to assign these parameters into a object and send it back to controller's action.
ia ma working on an asp.net mvc 2 app and i have a Users view, displaying all the users of the database. Then, i would like to add the ablility to display "users starting with fisrt name" capabaility on the same view. For this i created a list of all english leters that actually are links (<a href="#">A</a>, etc...)
I managed to handle the click event of each one of the letters and get the corresponding letter via jquery, but i don't know how to call theHttp.Post Users/FindUserByFirstLetterName(string letter) on the click event.
I cannot use the Html.ActionLink<> helper, since it redirects me to the HttpGet controller action.
I also tried using using jqery.Post but i also couldn't manage to call the action.