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 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 ..
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'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 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.
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 got a ASP.Net website (webforms application in C# - .Net framework 2.0) with Master Page, webforms and a GlobalFunctions class in App_Data folder where i do have ErrorLog functions and few other generic functions. Everytime an exception is caught in my webform it calls this GlobalFunctions.Errorlog function to log the error in my database table. After the exception details are written to the database table, I also would like to redirect the user to my ErrorPage.aspx like
Response.Redirect("ErrorPage.aspx",false);
However since i am inside a class (GlobalFunctions.vb) and not a webform, I don't know how to redirect this to ErrorPage.aspx since i can't access Response class.
I have a page that when the user clicks a button there is a custom loading panel placed in the update panel by the PageRequestManager BeginRequest event. So when the page is loaded the loading panel is removed. My issue is that when the user clicks a button that redirects to an httphandler the page is not reloaded therefore the loading panel is never removed.
So I'm trying to think of a way to remove the loading panel before the redirect occurs, whether this be with a client script call before the redirect or what ever. So far I've thought about trying to do Response.write("..."), then Response.Redirect().