.NET MVC

385

Solutions

291

Contributors

Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Share tech news, updates, or what's on your mind.

Sign up to Post

We have an ASP.NET MVC applicaiton (Framework 4.5) deployed on IIS 8.0 on WINDOWS 2012 R2 Server. We got compliance issue from Security Team to Disable TLS 1.0 on this production server.
At present below settings are done on the server and it is verified using SSL LABs Test
SSL 2 : Disabled
SSL 3 : Disabled
TLS1.0: Enabled
TLS1.1: Disabled
TLS1.2: Enabled.

The application is working find with above settings. As soon as I disable TLS1.0 and perform server restart, the web application doesn't work and I get below error (also refer attached screenshot)
Can’t connect securely to this page
This might be because the site uses outdated or unsafe TLS security settings. If this keeps happening, try contacting the website’s owner.
Your TLS security settings aren’t set to the defaults, which could also be causing this error.


As soon as I revert back by Enabling TLS 1.0 the application seems to be working fine. Some how the application (or) the WIN 2012 server is using by default TLS1.0. How can change this to point to TLS 1.2.  So that the application works fine after disabling TLS 1.0

Below are few Troubleshooting I had performed and none of them worked.
1.  Added  below code at Action Result method of First Controller the application hits.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 

Open in new window


2.  Tried by upgrading the application from Framework 4.5 to 4.6.2 and deployed to the server. …
0
Python 3 Fundamentals
LVL 19
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

we use google hang out phone no. to forward the calls to our clients.
is it any api with c# library we can use to retrieve the call activities and etc.
0
I have membership website want to integrate with qr code. basically, the member will receive qr code by email. when the member show up the QR codes on paper or phone. we want to scan it and then save the record like check in date and time.

this is mvc c# app.

and how can I do that?
0
In response i have data as below:
<!DOCTYPE html>
<html>
<head>
<body>
.............
<div id="divtag">
                   
<table id='tblMainResult' width='100%' style='border: 0.5px solid #999999;' class='UploadAdjustmentTable'><tr style='height: 40px;'><td width='100%'><strong style='font-size: 12pt;'> XML Validation Results for: 30-Aug-2019</strong><br /><br /></td></tr><tr style='background-color: lightgray; height: 25px;'><td width='100%'><strong>Validate Presence of all 10 reports in XML </strong> </td></tr><tr><td width='100%' align='left' valign='top'><br /> Check 1:-Confirm XML contains 10 reports - <span style='color:green; font-weight: bold'>PASS </span><BR/><br /></td></tr><tr style='background-color: lightgray; height: 25px;'><td  width='100%'>
..........................
</td></tr></table></div><br /></td></tr><tr><td><br /> </td></tr>
</table>
</div>
...................
</body>
</head>
</html>

how to display only <div id="divtag"> content on page?


i need to display below after  success: function (response) { line?

   $.ajax({
                    url: '@Url.Action("CreateAndSubmitXML", "ExternalSubmission")',
                    data: JSON.stringify({
                        SelectedBusinessDate: selectedCobDate,
                        SelectedBusinessName: businessDatesText,
                        Reason: adjComments
                    }),
                    type: 'POST',
                    datatype: 'json',
            …
0
Hi,

i am getting html response in below variable which is bold below line:
     success: function (response) {

i need help on how to bind this html response to DIV tag which is below:

Code:

  $.ajax({
                    url: '@Url.Action("CreateAndSubmitXML", "ExternalSubmission")',
                    data: JSON.stringify({
                        SelectedBusinessDate: selectedCobDate,
                        SelectedBusinessName: businessDatesText,
                        Reason: adjComments
                    }),
                    type: 'POST',
                    datatype: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function ([b]response[/b]) {
                        //alert("show");
                        debugger;
                        alert(response);
                        $('#divtag').html(response);

Open in new window




tried with below but not working:
1.   $('#divtag').html(response);

2. $(".result").html(response);
$(".result").append(response);
$(".result").txtresult(response);
<div class="result">
0
do u have a JavaScript code for the following

phone no mask (310)597-0000
ssn 111-11-1112

I just want to put it in separate J's file
but I don't want use the library.
0
I use jdatatable on mvc razor page. When it is loaded, everything is working. But when I click on sort button e.g. state, bond  name and etc. the following html part  is disappeared.
do you know how  to fix it?
In javascript, i used innerhtml or append and it still does  not work. thanks


td = td + "<tr>";
        td = td + "<td>" + "guidKey" + "</td>";
        td = td + "<td>" + "guidKey" + "</td>";
        td = td + "<td>" + "guidKey" + "</td>";
        td = td + "<td>" + "guidKey" + "</td>";
        td = td + "<td>" + "guidKey" + "</td>";
        td = td + "<td>" + "01/01/2011" + "</td>";
        td = td + "</tr>";



<table id="datatable2" class="table display responsive nowrap">
                <thead>
                    <tr>
                        <th class="wd-15p">Applicant</th>
                        <th class="wd-15p">State</th>
                        <th class="wd-20p">Bond Name</th>
                        <th class="wd-15p">Bond Amount</th>
                        <th class="wd-10p">Action</th>
                        <th class="wd-25p">Created On</th>
                    </tr>
                </thead>
                <tbody id="bodyData">
                    <tr>
                        <td>Tiger</td>
                        <td>Nixon</td>
                        <td>System Architect</td>
                        <td>2011/04/25</td>
                        <td>$320,800</td>
                        <td>t.nixon@datatables.net</td>
      

Open in new window

0
do u know any open sources codes can call Facebook, twilio and LinkedIn in the same time assume the message is the same?  in c# and mvc
0
do you know any open source social network template n database I can download?
using Mvc not core
0
in itextsharp c# how to populate fields in two or more PDF document
0
Ensure you’re charging the right price for your IT
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

I have mvc razor form and look for a esign pad so the user can sign. also need api to get the signature
0
I have this string in json {"columnC":"1","columnA":"2","columnB":"2"}
How can I use for loop to generate  like

ColumnC: 1
ColumnA: 2
ColumnB: 2

Thanks
0
I have Json & MVC / c# question below:

the var json = JSON.stringify(data); return json format
like {"column":"1","columnA":"2"}

My question is inside of the C# mvc ReceiveJson: How to extract the value like

column = 1
columnA = 2

and i want to be like insert table column, columnA values (1,2)

And {"column":"1","columnA":"2"} is it a json format?

*** formdiv *** inside of it, it just a combination of some <input id='column'> or <select id='columnA'>
function Submit(domain) {
    var x = $('#formdiv *').serializeArray();
    var data = {};
    $.each(x, function (i, field) {
        data[field.name] = field.value;
    });
    var json = JSON.stringify(data);
    alert(json);
    $.ajax({
        url: domain + "/Api/ReceiveJson",
        type: "POST",
        data: {
            'message': json
        },
        dataType: 'json',
        success: function (data) {
            alert(data.BondCode);
        },
        error: function (msg) { alert(msg); }
    });
    return false;
}

[HttpPost]
        public JsonResult ReceiveJson(List<string> message)
        {             
            var jsonResult = Json(message);
            domainCompanyBondType.BondCode = "1";
            return Json(domainCompanyBondType, JsonRequestBehavior.AllowGet);
        }

Open in new window

0
I use vector map. and I hope to capture the selected US state (california) on click when California area is clicked, and then pop up a modal. so I can take the selected state (California) and develop some api call.

Do you know how to do that? Just capture the state and get modal up.



http://jvectormap.com/maps/countries/usa/
0
I'm new to MVC and have inherited an MVC code-base.

I simply want the user to have to check a box to agree with terms and conditions. The code below let's the user proceed whether they have check the CheckBoxFor.AuthorizeAchTransaction  or not.

VIEWMODEL
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyProject.ViewModels
{
    public class ACHViewModel
    {
        [Display(Name = "Routing Number")]
        [Required]
        [RegularExpression("^((0[0-9])|(1[0-2])|(2[1-9])|(3[0-2])|(6[1-9])|(7[0-2])|80)([0-9]{7})$", ErrorMessage = "Invalid Routing Number")]
        public string ACHRoutingNumber { get; set; }

        [NotMapped] // Does not effect with your database
        [Display(Name = "Routing Number (Confirm)")]
        [System.ComponentModel.DataAnnotations.CompareAttribute("ACHRoutingNumber", ErrorMessage = "Routing number doesn't match.")]
        [Required]
        public string ConfirmACHRoutingNumber { get; set; }

        [Display(Name = "Account Number")]
        [Required]
        public string ACHAccountNumber { get; set; }

        [NotMapped] // Does not effect with your database
        [Display(Name = "Account Number (Confirm)")]
        [System.ComponentModel.DataAnnotations.CompareAttribute("ACHAccountNumber", ErrorMessage = "Account number doesn't match.")]
        

Open in new window

0
I use mvc host to write some mvc razor webpage on dnn 9. and I also my own dll library that I want to import and use it as reference on razor webpage.  is it possible?

I also want to see if I can use dapper with mvc razor.

thanks
0
I have been tasked to create a Spotlight type of report.  I am thinking the best way to get all the data I need for each "cell" of the report would be to create a Stored Procedure the contains multiple output parameters with the result of each cell rather than creating multiple methods in a partial model or something like that.  

I need some advice, tips or any help on how to add a Stored Procedure with out put parameters to my EDMX and then use that data in a View.
0
Do you know where I can download MVC AdminLTE combination with MS SQL Server to manage the users/roles and etc?
0
I tried to get mvc class inside of javascript like below. but it alerts that fixed up with javascript codes. Is it a way to use mvc inside of javascript?

@MasterHelper.Generic.DecryptPassword(data[index].passcode);


 function UserInfo()
    {
        var userid = localStorage.getItem("userid");
        $(document).ready(function () {
            $.ajax({
                url: "/Api/UserInfo",
                datatype: "text",
                type: "POST",
                data: { 'userid': userid},
                dataType: 'json',
                success: function (data) {
                    $.each(data, function (index) {
                        var test = data[index].passcode; 
                        document.getElementById("firstname").value = data[index].firstname; 
                        document.getElementById("lastname").value = data[index].lastname; 
                        document.getElementById("passcode").value = @MasterHelper.Generic.DecryptPassword(data[index].passcode); 
                        document.getElementById("emailadr").value=data[index].email;                            
                    });
                },
                error: function (msg) { alert(msg); }
            });
        }); 
    }

Open in new window

0
Starting with Angular 5
LVL 19
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

I have multiple modals one page.  There are opened from a partial view. When I open a modal the first time all functionality is working as expected.  However when a second modal is loaded certain functionality is broken like auto-focus and jQuery accordion are no longer working.  I believe it's because the modal is not being properly destroyed and or removed from the DOM.  However I'm unsure on how to destroy the modal properly.

Button to open modal
<a class="fa fa-info btn btn-link" href="#" onclick="ShowExamDetails(@item.user_exam_id)"> Details</a>

Open in new window



Modal
     <div class="modal" id="myModalDetails" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel"><strong style="color:#285e8e"> Details of</strong> User Exam</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>
                            <div class="modal-body" id="myModalBodyDiv">
                                @*Partial View Renders Here*@
                            </div>
                            <div 

Open in new window

1
Hi Experts,
How can i show a simple modal pop up in MVC? I have a log in page. When it is a valid login, it takes me to the main page. On the top of main page I need modal pop up with a messge "Welcome X" and some other static contents.

Please help.
Thanks in advance!
0
I am creating the WebGrid on the code behind, and am trying to get the cell value so I can format depending on the value.

This is the code I am currently using to populate the WebGrid which works well.  I would like to loop through the rows get a certain cell value and then change the font color how can I do that?

            IGrid<LastActivity> grid = new Grid<LastActivity>(rptRepository.GetLastActivity());
            grid.ViewContext = new ViewContext { HttpContext = HttpContext };
            grid.Query = Request.Query;

            grid.Columns.Add(model => model.OppOwner).Titled("Owner");
            grid.Columns.Add(model => model.OppCount).Titled("Count");


            grid.Id = "grdLastActivity";

            grid.Pager = new GridPager<LastActivity>(grid);
            grid.Processors.Add(grid.Pager);
            grid.Pager.RowsPerPage = 10;

            var oppcount = grid;

            foreach (IGridColumn column in grid.Columns)
            {
               
                column.Filter.IsEnabled = false;
                column.Sort.IsEnabled = true;
 
            }

            return grid;

Open in new window

0
I am using Entity Framework 6 in an MVC 5 project with a SQL database. One of the tables in the database uses integer values for the status_id. I want to assign those values a name in the view rather than presenting the integers. I am having difficulty determining the best way to handle this. My first thought was using a foreach loop but I am having difficulty with the syntax and that may not be the best route.

Relevant part of the View to this question (code remove for brevity)

@model Models.Meeting

@{

    ViewBag.Title = Model.Customer1.Name;
}

<body>
    <div id = "MeetingDetails" class="EmailDetails">
        <h2>Meeting Details</h2>
        <hr />
        <dl class="dl-horizontal">
            <dt>
                @Html.DisplayNameFor(model => model.Customer1.Name)
            </dt>
            <dd>
                @Html.DisplayFor(model => model.Customer1.Name)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.Customer1.status_id)
            </dt>
            <dd>
                @Html.DisplayFor(model => model.Customer1.status_id)
            </dd>
            <br />
        </dl>
    </div>
</body>

Open in new window


Relevant portion of Controller (code removed for brevity)
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Meeting meeting = db.Meetings.Find(id);
            if (meeting == null)
            {
                return HttpNotFound();
            }
            foreach (string download in Request.Files)
            {
                if (Request.Files[download].FileName != "")
                {
                    string path = AppDomain.CurrentDomain.BaseDirectory + "/uploads/";
                    string filename = Path.GetFileName(Request.Files[download].FileName);
                    Request.Files[download].SaveAs(Path.Combine(path, filename));
                }
            }
            return View(meeting);
        }

Open in new window


Model Diagram
Model Diagram for Two Tables
Partial screenshot of Details View. The value in the Prospect Status row is the integer value in the status_id in the Customer table.

TestMeetingDetailsScreenshot.JPG
0
I have the following api to call MVC.net controller, and it works just fine.
Now, I have some service called https://api.xxx.com/Accounting/Test and I replace it but it is not working.
The  c# parameters and method is  the same. so do you have any ideas what is going on?

 $.ajax({
            url: "/Accounting/Test",
            dataType: 'json',
            data:
            {
                'asso': assoValue
            },

Open in new window

0
on my mvc, I want to the its identity and role based option. I understood there is google, facebook, and etc.
and I own have a custom Single Sign on for one of the providers for our own business. Let us call it FirstSSO
and I want FirstSSO to be used by default. Just assume that someone put login/password in  the form, and it  will take FirstSSO first instead of the using local MS SQL for auth.

Thanks,
0

.NET MVC

385

Solutions

291

Contributors

Microsoft’s ASP.NET MVC is a web application framework that implements the model–view–controller (MVC) pattern. As an open-source software, it’s set apart from the ASP.NET Web Forms component, which is proprietary.

Top Experts In
.NET MVC
<
Monthly
>