In old sweet Web Forms times, when we make change on code behind, once we hit the application, it was compiling on the fly and running new changed code.

For Web Apps and MVC, when I add a new controller or change something on business logic, I have to always build app on VS 2015 manually and go back to browser and test again. But many times I keep forgetting building till I see yellow error screen.

Is there any way to kick build if there is code change and if I hit the website first time like Web Forms? I would not prefer to build on save since I am a ctrl + S freak, and keep pressing that combo on every other second.

Keep getting hit on this open redirect issue.

Thank you in advance for the help!

    string vc = Session["VCNumber"].ToString();
    string vif = txt_VIF.Text;

    Response.Redirect("/RCSSecure/SARS/VIF/VIF_v3_1.aspx?VCVIFNumber=" + vc + vif);

My view contains the following table definition:

<table>
    <thead>
    <th>Title</th>
    <th>Artist</th>
    <th>Genre</th>
    <th>Price</th>
    </thead>
    @foreach (var album in Model)
    {
        <tr>
            <td>@album.Title</td>
            <td>
                @{
                    foreach (var artist in ViewBag.Artists)
                    {
                        if (artist.ArtistID == album.ArtistID)
                        { @artist.Name }
                    }
                }
            </td>

            <td>
                @{
                    foreach (var genre in ViewBag.Genres)
                    {
                        if (genre.GenreID == album.GenreID)
                        { @genre.Name }

                    }
                }
            </td>

            <td>@album.Price</td>
            <td>
                <a asp-action="Details" asp-controller="Albums">Details </a>
                <a asp-action="Edit" asp-controller="Albums">Edit </a>
                <a asp-action="Delete" asp-controller="Albums">Delete</a>
            </td>
        </tr>

    }
</table>

The Details, Edit, and Delete options in the final column need to be keyed to the AlbumID property of the album variable, in order to ensure that the redirect operates on the proper album. I had thought the parameter for this might be asp-parameter, much like the action is set by asp-action, but this does not appear to exist.

What is the proper method to pass a variable as a URL parameter (for instance, /Albums/Details/var), and what name is used to retrieve this on the other side?

Shyju's answer deals with passing the parameter; my attempts at retrieving the parameter thus far have been as follows:

<%=Url.RequestContext.RouteData.Values["id"]%> - Fails to load, invalid character <.

ViewContext.RouteData.Values["id"] - Fails to load, cannot compare int and object using ==.

RouteData.Values["id"] - Compilation error, name does not exist in current context.

I have a razor view which HTML output is a table formatted with DataTables javascript plug-in to enhance it with fancy features as pagination, sorting, searching, etc.. My view looks like follows:

My asp.net MVC app with Datatables

Everything works like a charm, but as you can see, the search box and the pagination bar(marked in red) appears alligned to the very right of the page instead of close to the table itself(I want it in the green box). Any idea to accomplish this?

Here is my Razor code:

enter image description here

I've tried with a container div for the table and a fixed width, as well as a fixed width for the table itself without success.

Help very appreciated!

This question is an epilogue of the great question Mix Razor and Javascript code where I learn about this syntax:

@if (foo)
{
    // C# code
    <text>
    // JS Code
    </text>
}

It worked well, until today, when I used a JS regex inside the <text></text> :

$('#bar').html(boo.replace(/<br([\/ ]*)>/g, "\r\n"));

Which throw a yellow page telling me that there was an issue with br( which can't be analyzed.

Is there an inline way to deal with it?

I have a web application (MVC5 ASP.NET) with registered users. Those users have some data in my DB. I want to allow them to give an access to a specific third-party to their data. To achieve that I'm gonna implement OAuth2 (in which I'll have the "Resource Server" and "Authorization Server" roles) using the Authorization Code type.

enter image description here

I understand that to proceed the authorization, the user will be redirected from the client's website to my application then back to the client's website in the end. Also, during this process, I want the user to have the possibility to create an account in my application just before giving the access to the third-party.

I known that in this context, the third-party will have to have a account in my system (in order to allow the exchange of authorization code & tokens or to proceed API calls). For that I think it might be good to use ASP.NET Identity because I already use it for my users.

The problem is that during the process, I have two parallels authentications to proceed: I need to authenticate my client and the user. I can authenticate the client based on his id/secret (sent in the header of HTTP Request) and the user on his login/password. I did some research in order to find out how to do that using ASP.NET Identity and I feel that I should use a Multi-Tenant architecture, maybe a library like https://github.com/JSkimming/AspNet.Identity.EntityFramework.Multitenant.

Preferably, I would like to have two distincts tables in my DB for my users and my clients (because they are two distincts entities) but i have the feeling that I can't do that with this kind of library, am I wrong?

Please let me known if there's something I misunderstood, I kinda discover this kind of subjects.

Thanks

I am creating pdf file using iTextSharp.pdf and iTextSharp.Text below is my code

 string source = "G:/F2290_2016_EFORM2290.pdf";
            PdfReader reader = new PdfReader(source);

            PdfStamper stmp = new PdfStamper(reader, new
            FileStream("G:/F2290_2016_EFORM2290.pdf", FileMode.Create));
            AcroFields form = stmp.AcroFields;
            IDictionary<string, AcroFields.Item> fs = form.Fields;
            foreach (var f in fs)
            {
                Console.WriteLine(f.Key);
            }

Here I am getting error

 PdfStamper stmp = new PdfStamper(reader, new FileStream("G:/F2290_2016_EFORM2290.pdf", FileMode.Create));

Error is The process cannot access the file 'G:\F2290_2016_EFORM2290.pdf' because it is being used by another process.

Currently i am going to get this as the text in my ck editor that i am getting in my ck editor when seen in debugging and the text is **demo text for testing** and if i add some text in addition to the already existing text and click on submit button that text that i had added is not getting saved and below is the code for button click or button submit

protected void btnCompleteTranscription_Click(object sender, EventArgs e)
    {
        string Status = "2";
        if (rbClientQC.Checked)
            Status = "5";

        string text = CKEditor1.Text;
        text = Regex.Replace(text, @"<[^>]+>|&#xa0;|&nbsp;", "");
        text = Regex.Replace(text, @"\s+", " ");
        text = text.Replace("&ndash;", "–");
        text = text.Replace("&rsquo;", "'");

        int lineCount = text.Length - Int32.Parse(ViewState["tccount"].ToString());
        float flinecount = lineCount / 65f;
        decimal lc = (decimal)flinecount;
        //decimal LineCount1 = Math.Round((decimal)flinecount);
        adm.MTGSaveTranscriptionWork(ViewState["id"].ToString(), CKEditor1.Text, Session["uid"].ToString(), Status, string.Format("{0:0.00}", lc.ToString()), ViewState["tccount"].ToString());
        string Text = "<html><body>" + CKEditor1.Text + "</body></html>";
        Text = Text.Replace("&lt;", "<");
        Text = Text.Replace("&gt;", ">");
        Text = Text.Replace(">style=", "><span style=");
        Text = Text.Replace("<span <", "<span></span> <");
        Text = Text.Replace("<p <", "<p> <");
        Text = Text.Replace("<del", "<s><span");
        Text = Text.Replace("</del", "</s></span");
        Text = Text.Replace("&nbsp;", " ");
        Text = Text.Replace("<s style=", "<s><span style=");
        Text = Text.Replace("<p <", "<p style=\"text-align:justify\"><span><");
        CKEditor1.Text = Text;



        string datefolder = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString(); 
        datefolder += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString();         
        datefolder += DateTime.Today.Year.ToString();

        string ComparePath = Server.MapPath("~/GDocs/" + Session["uid"].ToString().ToUpper() + "/Transcribed/" + datefolder);
        if (!System.IO.Directory.Exists(ComparePath))
        {
            System.IO.Directory.CreateDirectory(ComparePath);
        }
        using (System.IO.StreamWriter file = new System.IO.StreamWriter(ComparePath + @"\" + ViewState["af"].ToString().Replace(".wav", "") + ".Doc"))
        {
            file.Write(Text);
        }

        Response.Redirect("MTGReadyToWork.aspx");
    }

and this is the code where i am binding the previous text to my ckeditor

public void BindTemplate()
    {

        string id = ViewState["id"].ToString();
        string queryString = "select WorkID,TranscribedData from Transcription where WorkID='" + id + "'";
        SqlDataAdapter adapter = new SqlDataAdapter(queryString, con);
        DataTable dt = new DataTable();
        adapter.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            string text = dt.Rows[0][1].ToString();
            CKEditor1.Text = text;
        }
        else
        {
        }
    }

i have this code which generates a log or report about exception and it uses string builder type variable to which exception's properties and values are appended which gets that by using exceptions object.so now when i call the send email method by putting string builder variable into the arguement the message body gets what's in this variable.So here i want my code to insert html elements like and in this message body of the mail to add some styling.To which i'm not getting any idea how to accomplish this,i simply need to write the exception property as bold and set the font family of the property and value to be different in the mail body.Please help me with this!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Configuration;
using System.Net.Mail;

namespace WebApplication5
{
    public partial class EnterMarks : System.Web.UI.Page
    {
        public float average,total;
       public string grade,chk,exmessage;

       DataClasses1DataContext db = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {   
            
           
        }

      

        protected void Button2_Click(object sender, EventArgs e)
         {
           
             tblExcDet te = new tblExcDet();
            var query1 = from n in db.tblContacts select n.StudentID;
           

                foreach (var q in query1)
                {
                    if (q.Equals((int.Parse(TextBox4.Text))))
                    {
                        Label2.Text = "ID Found";
                    }
                }
                try
                {


                    int? i = null;
                    tblContact tc = new tblContact();
                    tc.StudentID = (int)i ;
                    //db.tblContacts.InsertOnSubmit(tc);
                    db.SubmitChanges();
                }
                catch (Exception ex)
                {
                   
                    
                    log(ex);
                    Label2.Text = "Can't assign null value into a table id";
                   
                }
                        
        }
       
        public static void log(Exception ex)
        {
            StringBuilder sbEMessage = new StringBuilder();
            DateTime mydatetime1 = DateTime.Now;
            sbEMessage.Append("Exception Message" + Environment.NewLine);
            sbEMessage.Append(ex.Message + Environment.NewLine);
            sbEMessage.Append(Environment.NewLine + Environment.NewLine);
            sbEMessage.Append("Exception Date and Time" + Environment.NewLine);
            sbEMessage.Append(mydatetime1 + Environment.NewLine + Environment.NewLine);
            sbEMessage.Append("Exception Source" + Environment.NewLine);
            sbEMessage.Append(ex.Source + Environment.NewLine + Environment.NewLine);
            sbEMessage.Append("Exception Hresult" + Environment.NewLine);
            sbEMessage.Append(ex.HResult + Environment.NewLine + Environment.NewLine);
            sbEMessage.Append("Exception Stack trace" + Environment.NewLine);
            sbEMessage.Append(ex.StackTrace + Environment.NewLine+Environment.NewLine);
            sbEMessage.Append("Exception Data" + Environment.NewLine);
            sbEMessage.Append(ex.Data + Environment.NewLine);
            sbEMessage.Append("Exception target site" + Environment.NewLine);
            sbEMessage.Append(Environment.NewLine + Environment.NewLine);
            sbEMessage.Append("Inner Exception");
            sbEMessage.Append(ex.InnerException + Environment.NewLine);
            sendEmail(sbEMessage.ToString());
        }
        public static void sendEmail(string emailbody)
        {
            MailMessage mailMessage = new MailMessage("kamal.enest@gmail.com", "kamalu960@gmail.com");
            mailMessage.Subject = "Exception";
            mailMessage.Body = emailbody;
            SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
            smtpClient.Credentials = new System.Net.NetworkCredential()
            {
                UserName = "kamal.enest@gmail.com",
                Password = "1011664123"
            };
            smtpClient.EnableSsl = true;
            smtpClient.Send(mailMessage);
        }
        
    }
}

The web application runs fine, when using IIS Express. I created a website in IIS which maps to the web application root folder of the VS web project

I have copied the solution to another machine and I've setup IIS the same way as on the original machine, host names, bindings, physical path mapping, security. In VS I use Local IIS under Web tab and the project url points to a hosts entry, i.e. http://www.example.com

As I said, it works on the original machine but not on the target machine.

  • DefaultController
  • Views\Default\home.cshtml enter image description here

enter image description here

routes.MapRoute(
"Default",                                              // Route name
"{controller}/{action}/{id}",                           // URL with parameters
new { controller = "Default", action = "Index", id = "" }  // Parameter defaults

I'm currently trying to paginate tables for printing based on the personID/person name. Currently it's paginating on each individual table record.
(This is an aspx page, within an aspx page, that uses ascx file within an iframe). How do I paginate this by each patient's table and not by each record?

table.ascx

<br class="clear" /><br />
    <table class="report-table" cellspacing="0" cellpadding="2">
        <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# Eval("Bil") %>' OnItemDataBound="Repeater1_OnItemDataBound">
            <HeaderTemplate>
                <tr>
                    <td>Seq</td>
                    <td class="BillingId">Billing Id</td>
                    <td class="DateOfService">Date of Service</td>
                    <td class="PrintNormalWrap">MD</td>
                    <td class="POS">POS</td>
                    <td class="CPT">CPT</td>
                    <td class="MODS">MODS</td>
                    <td class="Charge">Charge</td>
                    <td>Diagnosis</td>
                    <td class="PrintNormalWrap">Referring Provider(UPIN)/Comment</td>
                </tr>
            </HeaderTemplate>

            <ItemTemplate>
                <tr class="<%# BillHasHold(Eval("HasHold")) %> billRowShade<%# Container.ItemIndex % 2 %>">
                    <asp:TableCell ID="tableCellSequence" runat="server"><%# Container.ItemIndex + 1 %></asp:TableCell>
                    <td class="BillingId"><%# FormatBillingId(Eval("BillingId"))  %></td>
                    <td class="DateOfService"><%# FormatShortDate(Eval("ServiceDate")) %></td>
                    <td class="PrintNormalWrapMD"><%# FormatDoctorField(Eval("DoctorName"), Eval("SupervisedByName")) %></td>
                    <td class="POS"><%# FormatField(Eval("Pos")) %></td>
                    <td class="CPT"><%# FormatField(Eval("CptCode"))    %></td>
                    <td class="MODS"><%# FormatField(Eval("Mod"))   %></td>
                    <td class="Charge"><%# Eval("Charge") %></td>
                    <td><%# FormatDiagnoses(Eval("Diagnoses"), Eval("BillDate"), Eval("SiteName")) %></td>
                    <td class="PrintNormalWrapRefPrvdr"><%# FormatNotes(Eval("RefMd"), Eval("RefUpin"), Eval("Notes"), Eval("TimeEntry")) %></td>
                </tr>
                <asp:TableRow ID="tableRowSpecialtyFieldDetails" runat="server" CssClass="specialtyFieldDetails">
                    <asp:TableCell colspan="9" runat="server"><span id="spanSpecialtyFieldDetails" runat="server"></span></asp:TableCell>
                </asp:TableRow>
            </ItemTemplate>
        </asp:Repeater>
     </table>
<p id="pageBreaker" class="pageBreak"></p>

aspx file

<head runat="server">
    <title></title>
    <link href="Css/ReportStyles.css" rel="stylesheet" type="text/css" />
    <link href="Css/ReportControls.css" rel="stylesheet" type="text/css" />
       <style type="text/css">
    @media print{
                .pageBreak {
        page-break-after: always;
    }

        .pageBreak:last-of-type{
            page-break-after: avoid;
        }
    }
</style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="theScriptManager" runat="server"></asp:ScriptManager>
        <im:UserSecurityControl ID="userSecurityControl" runat="server" />


        <div id="report-controls">
            <div id="batch-action-tab-container">
                    <div id="batch-action-tabs">
                       <span id="print-batch-tab" class="selected">Encounter Reports</span>
                       <span id='print-face-sheet-tab'>Print Face Sheets</span>
                     </div>

                    <div class="batch-action-panel" id="print-batch-panel">

                        <input type="button" id="generate-report" value="Generate Report" style="float: right; margin: 10px;" /> 

                        <div style="float: left; margin-left: 20px;">
                            <label class="reportControlsHeader" style="margin-left: 5px;">Report Type</label><br />
                            <input type="radio" class="main-report-type" name="main-report-type" value="1" checked="checked"  /> Physician Encounters
                            <br />
                            <input type="radio" class="main-report-type" name="main-report-type" value="2"  /> Patient Details
                            <br/>
                        </div>

                         <div class="grouping-options">
                            <label class="reportControlsHeader" style="margin-left: 25px;">Group By</label><br />
                            <div class="option">
                                <input type="radio" class="main-report-grouping" name="main-report-grouping" value="0" checked="checked"  /> <span>Encounter Date</span>
                            </div>
                            <div class="option">
                                <input type="radio" class="main-report-grouping" name="main-report-grouping" value="1"  /> Name
                            </div>
                            <br />
                            <div class="option">
                                <input type="radio" class="main-report-grouping" name="main-report-grouping" value="2"  /> Facility
                            </div>
                            <div class="option">
                                <input type="radio" class="main-report-grouping" name="main-report-grouping" value="3"  /> Group Name
                            </div>
                             <div>
                               <input id="paginateCheckBox" type="checkbox" class="main-report-grouping" name="main-report-grouping" value="3"  /><span>Paginate each patient</span> 
                            </div>  
                            <br />
                        </div>

                    </div>

                     <div class="batch-action-panel" id="print-facesheet-panel">

                         <input type="button" id="generate-facesheets" value="Generate Face Sheets" style="float: right;  margin: 10px;" />
                        <div style="padding-top: 10px; padding-left: 10px; ">
                             <input type="checkbox" checked="checked" id="facesheet-include-bills" /> Include Bills
                             <input type="checkbox" id="facesheet-sort-lastname" style="margin-left: 140px;" /> Sort by Last Name
                         </div>
                         <div>
                             <input type="checkbox" id="facesheet-include-holds" style="margin-left: 40px;" /> Include Holds 
                         </div>
                     </div>
            </div>
        </div>

        <div id="report-container">
            <div id="report-toolbar">
                 <div id="print-button" style="float: right;">&nbsp;</div>
            </div>
            <iframe id="report-display" border="0"></iframe>

        </div>


    </form>
</body>
</html>

I use Angular 2 and ASP.Net MVC. When sending data(the getData method) to the server receive null. For the test, I tried to send a post request using jquery ajax, everything went well. Please tell me what is the problem?

properties.service.ts

import { Injectable }     from '@angular/core';
import { Http, Response } from '@angular/http';
import { Headers, RequestOptions } from '@angular/http';

import '../../../shared/rxjs-operators';
import { PropertyNode } from './property.model';

@Injectable()
export class PropertiesService {
    private headers = new Headers({ 'Content-Type': 'text/plain; charset=UTF-8' });
    private dataUrl = 'Editor/returnProperties';

    constructor(private http: Http) { }

    getData(FullName: string): Promise<PropertyNode[]> {
        let body = JSON.stringify({ FullName: FullName});
        let options = new RequestOptions({
            headers: this.headers
        });

        return this.http.post(this.dataUrl, body, this.headers)
            .toPromise()
            .then(this.extractData)
            .catch(this.handleError);
    }

    private extractData(res: Response): PropertyNode[] {
        let data = res.json();
        let properties: PropertyNode[] = [];
        console.log(data)
        return data;
    }

    private handleError(error: any) {
        console.error('An error occurred', error);
        return Promise.reject(error.message || error);
    }
}

EditorController.cs

[HttpPost]
public JsonResult returnProperties(string FullName)
{
    try
    {
        PAVBaseDataItem node = IDE.MvcApplication.fDataProvider.RootItem.ChildItem(FullName);
        List<PAVBasePropertyItem> properties = node.PropertiesList();
        return Json(properties);
    }
    catch (Exception ex)
    {
    return Json("");
    }
} 

Screenshot c# debug, Screenshot chrome-devtools.

Hi I'm trying to make a website for my company and I'm trying to get user accounts to work however everytime I try to register a new user on the register page it does not create a user in the database. I have confirmed this multiple times by looking in the SSOX localDB. The website is written in asp dotnet core. The only modifications I have done to this after the authentication template is added a user column using Entity Framework code first, and have added the user input into forms and the controllers accordingly. I have also followed the tutorial on https://docs.asp.net/en/latest/security/authentication/accconfirm.html to add account confirmation.

As dotnetcore asp is fairly new there is not many questions asked and I have searched for my problem on google and also on stack but have failed to find an answer to my problem. I have included my code for the Account Controller, Register View Model and Register View below.

If anybody knows of a solution I would be very greatful.

Account Controller Register code:

// GET: /Account/Register
            [HttpGet]
            [AllowAnonymous]
            public IActionResult Register(string returnUrl = null)
            {
                ViewData["ReturnUrl"] = returnUrl;
                return View();
            }

            //
            // POST: /Account/Register
            [HttpPost]
            [Authorize]
            [ValidateAntiForgeryToken]
            public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null)
            {
                ViewData["ReturnUrl"] = returnUrl;
                if (ModelState.IsValid)
                {
                    var user = new ApplicationUser { UserName = model.UserName, Email = model.Email };
                    var result = await _userManager.CreateAsync(user, model.Password);
                    if (result.Succeeded)
                    {

                        // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
                        // Send an email with this link
                        var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
                        var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
                        await _emailSender.SendEmailAsync(model.UserName, model.Email, "Confirm your account", $"Please confirm your account by clicking this link: <a href='{callbackUrl}'>link</a>");
                        //Line commented to prevent user logging in without confirming account. //await _signInManager.SignInAsync(user, isPersistent: false);
                        _logger.LogInformation(3, $"User {user.Id} created a new account");
                        return RedirectToLocal(returnUrl);
                    }
                    AddErrors(result);
                }

                // If we got this far, something failed, redisplay form
                return View(model);
            }

Here is my RegisterViewModel Code:

using System.ComponentModel.DataAnnotations;

namespace MainSite.Models.AccountViewModels
{
    public class RegisterViewModel
    {
        [Required]
        [Display(Name = "Username")]
        public string UserName { get; set; }

        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }
}

And my Register View code:

@model RegisterViewModel
@{
    ViewData["Title"] = "Register";
}

<h2>@ViewData["Title"].</h2>

<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
    <h4>Create a new account.</h4>
    <hr />
    <div asp-validation-summary="All" class="text-danger"></div>
    <div class="form-group">
        <label asp-for="UserName" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input asp-for="UserName" class="form-control" />
            <span asp-validation-for="UserName" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="Email" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input asp-for="Email" class="form-control" />
            <span asp-validation-for="Email" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="Password" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input asp-for="Password" class="form-control" />
            <span asp-validation-for="Password" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input asp-for="ConfirmPassword" class="form-control" />
            <span asp-validation-for="ConfirmPassword" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button type="submit" class="btn btn-default">Register</button>
        </div>
    </div>
</form>

@section Scripts {
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

I have created a project with process start in c# it's running in local visual studio build,when I hosting it in IIS it's not running but it's starting the processes and nothing is displaying I checked it in task manager.Code sample:

Process process = new Process();process.StartInfo.FileName = "calc.exe";process.StartInfo.UseShellExecute = false;process.Start()process.WaitForExit();

And I have tried following solutions

IIS7 does not start my Exe file by Process Start

Foo.cmd won't output lines in process

System.Diagnostics.Process.Start not work from an IIS

nothing helped.If any one knows please help me

I have a list of Json array resulting in console as [o.fn.init[3], o.fn.init[0], o.fn.init[2]]

0 : o.fn.init[3] 0 : Object { AccountID : null ActiveStatus : null AprovalCount : null }

how to retrieve only the object instead of o.fn.init[3] using jquery?

The above JSon array is a result of console.log(extractingInterimBenefits)

JS:

function interimBenefitListFromDivision(divId)
{
var filteredInterimBL = [];
var extractingInterimBenefits = [];
//debugger
$.each(filteredProjects, function (key, val) {
    //debugger         
    filteredInterimBL = $(benefitManagementBenefitDistribution.interimBenefitList).filter(function (i, n) {
        //debugger            
        return n.ProgramProject == val.ID
    })
    extractingInterimBenefits.push(filteredInterimBL);

    console.log("projectIDS")
    console.log(val.ID) //ex:ID:518
    console.log("filtered INTERIM BENEFit LIST")
    console.log(filteredInterimBL)       
});

 console.log("extract interim")
 console.log(extractingInterimBenefits)
}

I need to develop a MVC 6 service which currently uses MS SQL Express database as data store. Later on, it may access another existing service or any other flexible data source. I have my solution structure like this.

 Service->Business->Data Access. 

Later on, if I want to extend my code, where should I have the logic to access another web service.i.e, in which layer..?? I know I need to use dependency injection, but where the switch of data sources should happen..??

I implemented a webservice in asp.net which should return fortune cookie text in JSON format. The service is working and i´m able to consume the output of the webservice. However, the output is not as expected...

Websevice JSON output:

{"d": "{\"CookieText\":\"All you have to know is - what the hell is d ???\"}"}

As you might guess, i´m looking for the value of "CookieText" - but i don´t know how to get that. I´m able to get the following output:

{"CookieText":"All you have to know is - what the hell is d ???."}

with the code (where result = Websevice JSON output):

jsonObject = new JSONObject(result);
result_intern = jsonObject.getString("d");

But what i´m relly looking for is just the value of CookieText. I tried the follwing lines with no success (result_intern is empty).

 jsonObject = new JSONObject(result);
 result_intern = jsonObject.getJSONObject("d").getString("CookieText");

I have two questions.

1) Why in the world is the output of the webservice packed into the variable (whatever?!) d ? Please enlighten me, what is the purpose of d? Is it something like 42? I really like to understand it before i send 1000s of hate mails to the developers. I did not tell anyone to put it into d... There is no d in the serialized class:

public class CFortuneCookieText
{
    private string m_CookieText = "";

    public string CookieText
    {
        get { return m_CookieText; }
        set { m_CookieText = value; }
    }
}

Webservice method:

[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] 
    public string GetFortuneCookieSayingsJSON()
    {
        CFortuneCookieText tmpObj   = new CFortuneCookieText();
        tmpObj.CookieText           = "All you have to know is - what the hell is d ???";

        return JsonConvert.SerializeObject(tmpObj, Formatting.None);
    }

2) How do i get just the value of CookieText with the uage of JSONObject.getString?

Thanks in advance

I'm new to ASP.Net Core and I need to write a middleware able to verify an header (user-key) and if exist and match to certain rules the user will be able to execute the API.
I perfectly now that there are a standard way based on claims or jwt token to do this but I cannot modify the client where the request is generated.

i'm using Vue.js in a Website and added the templates in the html Code and the js-Code in a single js-file. So i do not want to use the *.vue <-> Vuefy/Browserfy approach but bundle and minify my js-files later.

As i have to use Asp.Net MVC i could use split the single Html-file in a view and insert the vue-div-elements hierarchically structured with @Render.Partial(...). This way i could do a clean separation and use the same system like the *.vue files.

Would this be a good practice?

Do you think it would be better to write the html and new Vue({}) in every partial .cshtml or just write the html code there and put the javascript into (a) js-file(s).

The js-code in script-tags could not be bundled and i don't like that much inline Code but it would a nice coupling of the components code.

By using multiple js-files i could store then in the views folder next to their partial partners and bundle them together with the VS Extension Bundler and Minifier. enter image description here

Are these thoughts usefull or is there still a good aproach for using vuejs templates in asp.net?

I have a strange problem with our ASP.NET web application in Microsoft Edge.

When clicking a button, the click event was called twice also the page init and pag load. The button has handles btn.ServerClick

This only happens on Microsoft Edge. Other browsers like Chrome, IE8, Safari are working okay.

Did any of you experience similar problem? What causes the problem and how did you able to fix this?

I reproduced the problem.This is my mark-up code for the button:

<button id="btn" runat="server" class="buttonctl">Click Me!</button>

This is the sample code:

Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub page_init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Private Sub btn_click(ByVal ao_sender As Object, ByVal ao_event_args As EventArgs) Handles btn.ServerClick

End Sub

End Class

I am trying to add a master page in my asp.net web app . But after i choose add new item i am not able to find master page to create one.Thanks in advance