asp.net-mvc-4

Is there any difference between HttpContext.Current.Request and HttpContext.Request?

我怕爱的太早我们不能终老 提交于 2021-02-18 08:38:52
问题 If I want to access Request object in controller action I need to write HttpContext.Request , whereas if I want to access the same object in MVC view, I need to write HttpContext.Current.Request . Is there any difference between them? The problem I am facing is that, the cookies which I set through HttpContext.Response.Cookies.Add in controller action are not being retrieved in HttpContext.Current.Request.Cookies collection in an MVC view, though I can see those cookies through javascript.

Netsuite Data Extraction to database [closed]

北战南征 提交于 2021-02-11 16:55:49
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Improve this question I need to export some tables of netsuite to mssql. How can i get the table structure and will insert that data to mssql . I need to use this data for my analytics tool. Can anybody help me on this ? 回答1: If you have purchased the SuiteAnalytics Connect bundle

How to disable the browser back button in my mvc from only my login page?

半城伤御伤魂 提交于 2021-02-11 14:00:23
问题 I tried this method by putting it in my login.cshtml but it doesnt work there at all. Then I tried putting it in my _Layout.cshtml but then it does it's job while affecting the entire website (as expected). Any tips on where I should put or how I should manipulate the code? here it is here: function preventBack() { window.history.forward(); } setTimeout("preventBack()", 0); 回答1: I recently used this in an MVC project. Maybe you can put it on the page that the login redirects to. //kill all

How to disable the browser back button in my mvc from only my login page?

♀尐吖头ヾ 提交于 2021-02-11 13:57:35
问题 I tried this method by putting it in my login.cshtml but it doesnt work there at all. Then I tried putting it in my _Layout.cshtml but then it does it's job while affecting the entire website (as expected). Any tips on where I should put or how I should manipulate the code? here it is here: function preventBack() { window.history.forward(); } setTimeout("preventBack()", 0); 回答1: I recently used this in an MVC project. Maybe you can put it on the page that the login redirects to. //kill all

Open Specified ASP.NET MVC Views From Hyperlinks Inside Email Body

我们两清 提交于 2021-02-10 22:22:41
问题 I just learn about ASP.NET MVC. I hava a website with this following scenario: Login -> Main Page (Index) -> Edit Page (Edit) So, In LoginController when user login, it will redirect to main page and edit a record from MainPage . Everytime a new record is created through ASP.NET MVC, the system will send an email to manager. Within email message, there is a hyperlink that will redirect the manager to edit form. But first, he needs to login because the edit form cant be opened unless he login.

Open Specified ASP.NET MVC Views From Hyperlinks Inside Email Body

会有一股神秘感。 提交于 2021-02-10 22:20:31
问题 I just learn about ASP.NET MVC. I hava a website with this following scenario: Login -> Main Page (Index) -> Edit Page (Edit) So, In LoginController when user login, it will redirect to main page and edit a record from MainPage . Everytime a new record is created through ASP.NET MVC, the system will send an email to manager. Within email message, there is a hyperlink that will redirect the manager to edit form. But first, he needs to login because the edit form cant be opened unless he login.

MVC custom login authentication

断了今生、忘了曾经 提交于 2021-02-10 15:13:59
问题 Hi I'm developing an app in MVC and I have a problem with login, I want to know how can I manage the login depending on the user role. While the moment the login works fine but I need to identify the role user for sending to different pages I have a table in my database call Employee and one column is call IdPosition that is referred to another table call Position. Here is my code [HttpPost] public ActionResult Autorizacion(Pepitos.Models.Employee employee) { using (pepitosEntities db = new

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

Upload multiple files/ filepath using asp.net mvc

可紊 提交于 2021-02-10 12:13:26
问题 I am creating a web application for an estate agency and on one of the forms used to upload properties i need to upload multiple images or files like floorplans in pdf format to a folder and store their path in the database(SQL SERVER). I have tried doing it on my own using some help from online resources but have not been able to sort it out. This is the part of my view with the file upload. <div class="file_inputs"> <input type="file" id="dev_brochure" name="dev_brochure" class="form

EnableCors for VB.net

江枫思渺然 提交于 2021-02-10 09:41:48
问题 Does anyone know how to put the enableCors into the controller on vb.net. i am working along with a pluralsight course and tried a code translator with no luck. my attempt is below. <EnableCors(origins: "http://localhost:53080", headers: "*", methods: "*")> 回答1: The correct syntax would be something like this: <EnableCors("http://localhost:53080", "*","*")> The C# example appears to use named parameters. VB.NET supports that too, however the EnableCorsAttributes has properties and contractor