url.action

Url.Action in controller generates port twice

别等时光非礼了梦想. 提交于 2021-02-10 12:56:51
问题 I am using below piece of code to generate a fully qualified url and pass it back as json for redirection. returnUrl = Url.Action("ActionName", "Controller", new RouteValueDictionary(new { type= returnUrl }), HttpContext.Request.Url.Scheme, HttpContext.Request.Url.Authority); returnUrl will initially have a value either type1 or type2 which is why I have given type as returnUrl and then replacing its value with a generated url , but it generates http://localhost:49518:49518/Controller

How to Open .pdf on a new Tab

前提是你 提交于 2020-05-11 04:15:32
问题 The Objective: I have to print a PDF on a new tab after some tasks have finished correctly. Steps: I want to execute a method that should go to the server, take the PDF and open it on a new Tab, I was trying with these but is not working: Controller : Export public ActionResult PrintPdf() { Response.AppendHeader("Content-Disposition", "inline; filename= " + MyClassPdfWriter.GetFileName); return File(MyClassPdfWriter.GetMemoryStream, "application/pdf"); } View : function TasksSucced(){ $.get('

Url.Action in jquery ajax: Second parameter not passed

安稳与你 提交于 2020-01-05 13:09:31
问题 I am trying to pass two parameters in an Url.Action function with jQuery ajax, and only the first parameter is passed. Both parameters show up correctly in the ajax function when I debug. The values passed in data are passed correctly. What am I doing wrong? Here is the code from the view: <script type="text/javascript"> $(function () { $("#sendForm").click(function () { //they both show correctly in the console console.log('@ViewData["recordURL"]'); console.log('@ViewData["title"]'); $.ajax(

How to format a URL.Action() call in JQuery to set a link's href attribute?

旧街凉风 提交于 2020-01-04 06:44:18
问题 I need to set the href attribute of a link to point to a specific image, which has its id from the database set as its title. However, I am having trouble with trying to format the string to include a call to get the title attribute of the image. Here is the base string: $("#favoriteLink").hover(function() { $(this).attr("href", '<%: Url.Action("FavoriteWallpaper", "Wallpaper", new{wallpaperId='+$(this).children.attr("title")+'}) %>'); }); favoriteLink is a div and the child is just one image

How to give user confirmation message before ActionLink based on validation

你说的曾经没有我的故事 提交于 2019-12-25 14:29:30
问题 I have the following link. On click, I'd like to check the item.primary_company field and if populated, give the user a warning and ask if they would like to continue. How can I do this? <a href="<%= Url.Action("Activate", new {id = item.company_id}) %>" class="fg=button fg-button-icon-solo ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span></a> EDIT I've changed to this, but nothing happens when clicked. Also, I don't know how to reference the item to do the check

ASP.NET Core Url.Action return empty string

本秂侑毒 提交于 2019-12-24 07:38:38
问题 After 3 hours browsing on stackoverflow I don't find solution of my problem. So I suspect something in my project is special. I have a ASP.NET Core (2.0) WebApplications Project on Visual Studios 2017. I try to make a ajax call from my Kalender.cshtml file: return $.ajax({ type: 'GET', url: myurl, data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { //REQUEST SUCCESS alert(result); }, with myurl: var myurl = '@Url.Action("EventsRead",

How does Url.Action work Asp.net MVC?

我只是一个虾纸丫 提交于 2019-12-21 03:47:20
问题 This is somewhat related to another question I've asked but I figure why not ask it seperately. If I were to place something like the following in a view <td><img src='<%= Url.Action( "DisplayImage" , "User" , new { id = item.id} ) %>' alt="" /></td> Is it supposed to display this? <td> <img src='/User.mvc/DisplayImage?id=U00915441' alt="" /> </td> Or would the value of the src-attribute actually be replaced with the results of the UserController GetImage Action? 回答1: It will construct the

Url.Action puts an & in my url, how can I solve this?

随声附和 提交于 2019-12-18 03:02:08
问题 I want to send the variables itemId and entityModel to the ActionResult CreateNote: public ActionResult CreateNote( [ModelBinder(typeof(Models.JsonModelBinder))] NoteModel Model, string cmd, long? itemId, string modelEntity) with this javascript: Model.meta.PostAction = Url.Action("CreateNote", new { cmd = "Save", itemId = itemId, modelEntity = modelEntity}); However, the url being send is localhost:1304/Administration/blue/en-gb/Entity/CreateNote?modelEntity=Phrase&itemId=44 I want to send

ASP.NET MVC Razor Url.Action doesn't work in Internet Explorer 8

人走茶凉 提交于 2019-12-13 01:47:49
问题 I developed a simple ASP.NET MVC3 project with Razor. Linking between pages, I use the following table: <table class="indexTable" align="left"> <tr> <td class="indexTd"> <a class="noUL" href='@Url.Action("Index", "ProblemEntrance")'><button class="menuButton">@ViewBag.ProblemEntrance</button></a> </td> So when I click on ProblemEntrance, it takes me from ProblemEntranceController to ProblemEntrance Index page. Everything works fine in Mozilla and Chrome, but with Internet Explorer, the page

how to remove the querystring parameters in url in mvc4 with razer using url.action

我的梦境 提交于 2019-12-13 01:43:34
问题 url.action is : <li><a href="@Url.Action("CategoryLevel", "Product", new { CategoryId = @item._categoryId, ProductName = @Html.Raw(item._categoryName) })">@Html.Raw(item._categoryName)</a></li> it works fine but i dont want to display the qyery string in url url is: http://localhost:99/Product/CategoryLevel?CategoryId=16&ProductName=Common%20Conditions i want to display this as `http://localhost:99/Product/CategoryLevel/16/Common%20Conditions` (or)`http://localhost:99/Product/CategoryLevel