Newest 'asp.net-mvc' Questions

Q&A for professional and enthusiast programmers

Get userId of logged in user when create new wall

I am developing a website that called myWall. when user wants to create a new wall, the user id is required. So, how can I get user Id of logged in user. I tried many ways that posted here (in stack ...

E_LoadingConf Roxy Fileman Custom Integration with MVC routing

Using an MVC Area I am using Roxy Fileman for file upload functionality. I am trying to use a custom integration when I do I get the error "E_LoadingConf". I verified my conf.json file is correct ...

Asp Mvc application throwing Server Error '/' in Application following assumed restart

Ok, been brooding over this for a few hours now, but I can't seem to grasp it. I have an ASP MVC application which throws a Server Error '/' in Application error after being left alone for 5 - 10 ...

ASP.Net Identity - creating custom GenerateResetPasswordAsync of UserManager Class

I have my own custom table of Users. And I want to override the GenerateResetPasswordAsycnc and VerifyResetPasswordTokenAsync of User Manager. What are the requirements to do this and how can I ...

Asp.net MVC project structure/architecture using generic repository [on hold]

I intend to develop a small-medium sized project but I am not sure how to design the structure for it. It's also because I am confused between the concepts (and purposes) like DTOs, Models, POCOs, ...

Error not showing when error in razor view aspnet core

When I add a call on viewComponent in a view and the viewComponent not working, there are not error message, the razor view skip the viewComponent in render and show the rest, but I don't no why the ...

Building a ASP.Net login and registration application with entity framework [on hold]

I want to implement login related functionality in my MVC application. The application will be bsed on two table User and USerRole. May you provide a good starting point to do this. I also want to use ...

MVC5: Async PartialView that has it's own controler and can recieve parameters

Basically my goal was to create a partial view that I could include in multiple pages and that would load it's own values depending on a parameter. I couldnt find anything that directly allowed this ...

Cant do redirect (ASP.NET MVC)

I need to do redirect to controller Here is my controller [HttpPost] public ActionResult Index(string question1, string question2, string question3, string question4, string question5, ...

C# creating stream object by using statement

I have one method to download s3 file Method Public ActionResult download(string filename, string credentials) { .... Using(stream res = response from s3) { return file(res, type, ...

Facebook and Google Redirect URL are not HTTPS

https://www.example.com I've installed SSL to my ASP.NET MVC 5 site, but the problem is the when I clicked Login with Facebook or Google the redirect url is not https https://web.facebook.com/dialog/...

How to display Image from folder using ASP.NET MVC

I create entity outside my Project this is solution Explorer My entity Post [Table("Post")] public partial class Post { public int PostID { get; set; } [Required] [StringLength(256)] ...

Service Pattern and Repository Pattern - failed because another entity of the same type already has the same primary key value

Error: Service Pattern and Repository Pattern - Attaching an entity of type failed because another entity of the same type already has the same primary key value. I have a Generic Service and Generic ...

The parameter conversion from type 'System.String' to type 'System.Web.Mvc.SelectListItem' failed

I am getting error in my MVC application. I have page where some textfields and one dropdown is there. Data is loading correctly to that page when When I submit the page, ModelState is returning error ...

Ready only access dynamically in entity framework UnitOfWork and DbContextFactory

I am working on MVC project and I am using entity framework with Repository pattern approach. Now I am wan to implement read only access to application. So is there any generic way I can implement ...

ASP.NET MVC File download in multiple ranges and resumable through internet download manager

I have a simple MVC controller action as follows: public ActionResult GetFile(string path) { //Do Some manipulation and finally download the file. return File(filePath, System.Net.Mime....

Client side Custom Validation with data annotations (MVC)

I'm writing custom validator attribute in asp.net mvc, Its working fine for server side validation. Here's demo code public class CustomEmailValidator : ValidationAttribute,IClientValidatable { ...

User Does Not Contain A Definition For Identity

I am attempting a simple assignment of a string to the current user ID in a service class like so: strCurrentUserId = User.Identity.GetUserId(); //My namespace references using HelpDesk.DAL; using ...

When we load DropdownList data asynchronously, should repository be static?

I have the following action in my ASP.NET MVC Core application. But I'm trying to figure out how to include data for a DropDownList in my view model (AssetViewModel). Since we load from database it ...

C# returning different types from function

I have written a following code which basically performs a JSON request towards my server: var client = new RestClient("mysite.com"); var request = new RestRequest(Method.POST); ...

Why won't Twilio.Asp.Net.MVC package download in Xamarin Studio console project? (MAC)

I'm currently trying to make a twilio app. Most of the packages have downloaded just fine, however when I attempt to download the "Twilio.Asp.Net.MVC" package it says that it's not compatible with ....

MVC Unit Testing - Mock a Request.QueryString

I am trying to mock a request.querystring within my ActionResult. The ActionResult. [HttpGet] public ActionResult Index(int id, MyModel myModel) { var myQueryString= Request.QueryString["...

Set multiple dropdowlnist value during edit operation using Angular js

I am using ASP.NET MVC with angular js. I have one page say hello.cshtml. In which I have one dialog box in where I have on button "Add", on click of that button I add new row in table in dialog ...

Generating one new field in table (ASP.NET MVC)

I have View where I create interview with greeting and details Here is table CREATE TABLE [dbo].[Interviews] ( [Interview_Id] INT IDENTITY (1, 1) NOT NULL, [Greeting] NVARCHAR (MAX) ...

How to filter DropDown list by logged in User in MVC

How to filter dropdown list, and i need to take name of logged in User. in controller i have this code: var agentBR = (Session["aID"]); ViewBag.AgentID = new SelectList(db.tbl_agenti.Where(x ...

Invoking Controller Action From JavaScript .NET MVC

A user can log into my app through Facebook. After the user presses the button to do initiate that, and authenticates through Facebook successfully, I then want the page that initiated the login, and ...

MVC 5 get value of CheckBox Checked in controller with Ajax.BeginForm

I use MVC 5 and I try to get the value of the checkbox checked in the controller but so far it always return null. Here is my code: In View @using (Ajax.BeginForm("Delete", "...

Mvc Linq search doesn't show foreign keys in list

I am trying to make a search for my index using linq. The search and everything works, but it doesn't show my foreign keys names Controller: public ActionResult Index(string search) { var ...

How to access Unvalidated Value in asp.net?

I have used: Request.Unvalidated.Form["valuefromcontrol"]; Because my control returns values in tags, i.e (<p> values </p>) etc. but it gives null values. I have searched about it and ...

WebGrid Search Exception - Error executing child request for handler

I want to make Search in WebGrid but it doesn't work. I have 2 methods in Controller [HttpGet] public async Task<ActionResult> ICare() {.... return View(tuple);} [HttpPost] public ...

Forbidden error after adding Application_Start

My ASP.NET MVC application was working fine until I wanted to initialize few application variables in Application_Start() of Global.asax. I started getting "HTTP Error 403.14 - Forbidden The Web ...

TextboxFor Datetime Prevent Submit

A have a problem which is I am sending Datetime to view. In HTTPGET i havent any problem i mean it shows date as formatted. But when i try to post it to controller it does not post. The date changing....

Role Provider couldn't be found in the System.web.security?

I want to inherit the abstract class RoleProvider. However, I am getting errors saying that RoleProvider doesn't exist in the Web.Security namespace. This is what I am following - https://msdn....

Jquery Dialog not working on image click

Workflow: Passing JSON to angular scope and using ng-repeat in the View to display it. Using following function to show dialog on click of elements of a particular class. $(function () { $("...

When i m using HTML5 <embed> tag, autoplay and autostart attibute is not working in google chrome?

<embed id="embd" autoplay="0" autostart="0" class="img-thumbnail center-block" src="@Url.Content(@t.ResourePath)" style="height: 200px; width: 300px"> Above is my code snippet ,i mtakin src ...

How do I get filtered set of data from another related table [on hold]

My idea is when I choose one item on view from dropdown list, in second dropdown list would be limited choices based on first pick. That means that I have to filter out that dependent data via LINQ ...

Handling multiple forms on a page

I have a page that is mostly informational data (not an input form, overall). And it has a title that can be edited. Clicking the Edit Title button pops up a modal window where the user can edit the ...

How to list items in a foreach using Tuple.Create by most recent entries

I am using trying to create a Messaging feature on a project that I am using and in order to do that I am using a foreach loop through the Model in order to bring in the messages that both the ...

kendo grid - dynamic column with cell format from database

I have a SQL Table result. ProductNumber ProductNumberColorClass OrderNumber OrderNumberColorClass I am trying to use Kendo to render this information. Basically i need the output as ProductNumber ...

Infinite Looping (Page Reload) Blues

What is it, about the code below, that would be causing the page I've successfully re-directed to, via the completeLogin() function, to continually reload itself? More Context- A user can log into ...

JsonRequestBehavior.AllowGet does not work with HttpGet

I've read MSDN documentation of JsonRequestBehavior.AllowGet and many answers here at SO. I experimented and I am still confused. I have the following action method. It works fine if I use POST ...

Unable to add response.write() in action method

Am trying to download bulk excel data so am using server.mappath() to save the file but problem is file is downloaded to the specific folder but i didn't get the download file in the browser. so how ...

Handle AJAX redirection for not authorized MVC

I am creating a MVC 5 application and loading partial views through AJAX. The problem I am facing is when the session expires or the user is not authenticated anymore. From what I have searched, there ...

changing Area Coes without rebuilding solution

I used Areas in my MVC5 projects. so i have to Rebuild my solution every time that i change Area Codes. but we saw some projects like orchard CMS which don't need any clean and build operation on ...

interface cannot be constructed. Are you missing a type mapping

I have been stuck on this for 2 days and I need some help. I am using Unity.Mvc5 package for DI. I have the ITest interface which is registered in the bootstrapper. But when I try to access the Class ...

DataTable cell button click event not fire in asp.net mvc

I have a datatable using an AJAX callback in a modal dialog. but into the cell button in datatable not fire jquery event. my code is given below. please correct me and advice whats wrong with this ...

String combination does not work [on hold]

Settings: asp.net mvc web app, azure sql db, EF code-first project I am trying to combine 3 strings and a short into one string as given below: CompanyAddress = company.ZipCode.ToString() + " " + ...

Multi tenant DB single code base [on hold]

I am trying an SaaS application with multi tenancy feature enabled I have successfully completed social media oAuth integration in my MVC application and it works perfectly fine Now I want to enable ...

ASP.NET MVC, C#, Entity Framework [on hold]

I am trying to update supplier in database when users on webform insert data into textboxes. First users in textbox for supplierID insert value, and on screen shows particular supplier from database....

Wait for form.submit() / POST to complete

I'm stuck in a really bizarre situation here. It's complicated to explain but I'll try my best. Detailed explanation of the issue: On every top Nav click (Green donuts/circles), or next button, I ...
Translating... 0%