I have web.config settings like this

<customErrors mode="On"  >
  <error statusCode="404" redirect="~/404" />
  <error statusCode="403" redirect="~/500" />
  <error statusCode="500" redirect="~/500" />
</customErrors>

and for httperrors

 <httpErrors errorMode="Custom" >
    <error statusCode="400" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\bad_request.html" />
    <remove statusCode="401" subStatusCode="-1" />
    <error statusCode="401" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\unauthorized.html" />
    <remove statusCode="403" subStatusCode="-1" />
    <error statusCode="403" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\forbidden.html" />
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_found.html" /><remove statusCode="405" subStatusCode="-1" />
    <error statusCode="405" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\method_not_allowed.html" /><remove statusCode="406" subStatusCode="-1" />
    <error statusCode="406" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_acceptable.html" />
    <error statusCode="407" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\proxy_authentication_required.html" /><remove statusCode="412" subStatusCode="-1" />
    <error statusCode="412" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\precondition_failed.html" />
    <error statusCode="414" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\request-uri_too_long.html" /><error statusCode="415" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\unsupported_media_type.html" />
    <remove statusCode="500" subStatusCode="-1" /><error statusCode="500" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\internal_server_error.html" />
    <remove statusCode="501" subStatusCode="-1" /><error statusCode="501" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_implemented.html" />
    <remove statusCode="502" subStatusCode="-1" /><error statusCode="502" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\bad_gateway.html" />
    <error statusCode="503" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\maintenance.html" />
</httpErrors>

On 404 Error. Skipping 404 page and goes to .aspxerrorpath= page.aspx and writing The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

I want to show my customized 404, 500 error page. What is the wrong

Best way to ask this question is by way of example..

Take counters

\ASP.NET\Request Execution Time & \ASP.NET\Request Wait Time

There are counters with the same name in the ASP.NET Applications bucket

\ASP.NET Applications\Request Execution Time & \ASP.NET Applications\Request Wait Time

Anyone know the difference between the two? Is there a difference? Is one a subset/superset of the other?

Thanks.

On button click we are get the data from the database that data i need to display in the text field but it working fine for me. but i try to get Id value from the $.each(data, function (i, v1) i cannot get ID value: var GenID = jQuery('[id$=hdnGenericID]').val(v1.Value);

 $("#btnClick").click(function () {
                var id = jQuery('[id$=hfCustomer]').val();
                $.get("GenericName_Bind", { ProductID: id }, function (data) {
                    $.each(data, function (i, v1) {
                         var GenID = jQuery('[id$=hdnGenericID]').val(v1.Value);
                        $('#txtGenericName').val(v1.Text);
                    });

                });
            });

I given one hidden filed and get ID value

 @Html.TextBoxFor(model => Model.productmaster.GenericName, new { @class = "form-control", @id = "txtGenericName", placeholder = "Generic Name" })

I have razor view with checkbox. I cant able to prepopulate checkbox with true/false . Here is my code

<label for="HousingBidsComps_99">&nbsp;</label>
<div class="check_box_group">
    <input type="checkbox" id="HousingBidsComps_99" name="HousingBidsComps[1].IsChargesIncluded" class="customCheckbox"  >
    <label for="HousingBidsComps_99" style="margin-bottom:0">
        <span style="margin-bottom:0">
            @Html.LabelFor(model => model.HousingBidsComps[1].IsChargesIncluded, new { @class = "padd-left-0" })
        </span>
    </label>
</div> 

Current setup: Visual Studio 2015 Professional and ReSharper Ultimate 2017.2.2.

I've started looking into ASP .NET MVC and I've found that ReSharper has been treating some Razor statements as errors.

For example, this is the Login.cshtml file that is autogenerated in an MVC project with individual accounts authentication.

Razor lines with errors.

The error for the line

@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })

is

The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly.

Weirdly, only some lines are considered errors. The code compiles and runs fine, I'm able to use the registration/login system the project generated fine. Its getting annoying seeing '72 errors in 17 files' in the bottom right when nothing is actually wrong.

Any ideas on how to remove these errors?

I am developing a site with asp. Net webpages and razor, I don't know how set the url property of an ajax function to a c# method

I want to create an HTML email from a Razor template. I'd like to do this using the Razor engine. I have created a simple Razor template and the corresponding model to supply my Razor template with data. I can't for the life of me find any simple examples of how to combine these together to create an HTML email.

The Razor API is bewildering and I'm not sure where to start.

Can anyone provide me with some very simple code examples of how to create an HTML email using a simple Razor template and model.

I have a Razor View which has a section where the user can add new rows for ad-hoc opening/closing times on specific dates. It consists of three controls - a DatePicker, two Select lists and a "delete row" button. Existing saved rows are rendered on page-load through Razor, and any new rows are added via an OnClick event and JavaScript appending largely fixed html to the DOM element. All rows are then saved (or removed as required) on HTTPPost.

I have a new requirement which requires implementation of a much more complicated data-set for these ad-hoc, "user-generated" rows. The HTML for each of these rows is extensive. Is there a more elegant way of injecting Razor within a View on a button click than appending hard-coded HTML in JavaScript?

i trying set full path of selected file into model in view.

Controller FileController:

public async Task<IActionResult> Create(CreateFileViewModel model)
    {
        if (ModelState.IsValid)
        {
            var file = new File
            {
                Path = model.Path
            };

            _context.Add(file);
            await _context.SaveChangesAsync();

            return RedirectToAction(nameof(Index));
        }

        return View(model);
    }

Model CreateFileViewModel:

public class CreateFileViewModel
{
    public string Path { get; set; }
}

Model File:

public class File
{
    public int Id { get; set; }
    public string Path { get; set; }
}

ViewForm Create:

<form asp-action="Create">
        <div asp-validation-summary="All" class="text-danger"></div>
        <div class="form-group">
            <label asp-for="Path" class="control-label"></label>
            <input asp-for="Path" id="selectedFile" type="file" />
        </div>
        <div class="form-group">
            <input type="submit" value="Create" class="btn btn-default" />
        </div>
    </form>

Script in Create:

<script>
document.getElementById('selectedFile').onmouseout = function () {     
    @Model.Path=this.value;
};
</script>

But

@Model.Path=this.value;

this not working. Ofc i cannot convert between razor and javascript variables. But i dont know another way how to set full path of selected file into model variable. This

<input asp-for="Path" id="selectedFile" type="file" />

set into model variable just file name, without path.

How to show the Html tags in ASP: Label in asp.net?

i was getting the code <script> </script> from database. how can show the value in <asp:label></label>

If am showing like this

<label class="label">
    <asp:Literal runat="server" ID="litProjectType" Text='<%# Eval("ProjectType")%>'></asp:Literal>

</label>

The value <script> </script> is change into HTML Tag

DATE

Im working with this view , so how can i remove this format dd/mm/yyyy and display nothing on it :

[DataType(DataType.Date)]
    [DisplayFormat(DataFormatString = "", ApplyFormatInEditMode = false)]






    public Nullable<System.DateTime> PatientDOB_ { get; set; }
 <div class="form-group">
                            <span class="mylabel">@Html.LabelFor(model => model.PatientDOB_, htmlAttributes: new { @class = "control-label col-md-4" })</span>
                            <div class="col-md-8">
                                @Html.EditorFor(model => model.PatientDOB_, new { htmlAttributes = new { @class = "form-control" } })




                                @Html.ValidationMessageFor(model => model.PatientDOB_, "", new { @class = "text-danger" })
                            </div>
                        </div>

I am trying to check if the path of network drive I wants to map is already exists in the computer drives, and if yes - it will not be able to map it. I read about the Directory.Exists() that helps me to achieve it, but what I only achieve with it is to show me the avilable drives on the computer. So, now, my code can get all the Drives' letters that avilable and not taken yet, but I'm still not able to check if the path is already mapped. For example, user wants to map a network drive with path of "\server\x\y\z" - How I can check if the path is already mapped in this computer? Any suggestions?

Within Visual Studio 2017 there is no ADO.net Entity model in 'Add New Item' menu? It is available on previous versions of Visual Studio. What kind of solution can fix that problem?

I try to write test for my Hub method, but I don't know as because there is no documentation or code examples for current (1.0.0-alpha2-final) version of SignalR. There is my code:

[Fact]
public void SaveVisitorInfoTest()
{   
    //Arrange
    var chatHub = new ChatHub();
    var mockClients = new Mock<IHubClients>();
    chatHub.Clients = mockClients.Object;
    dynamic groups = new ExpandoObject();
    var groupName = "SomeConversation";
    string actualName = null;
    string expectedName = "someName";
    groups.SendVisitorInfo = new Action<string, string>(n => {
        actualName = n;
    });
    mockClients.Setup(_ => _.Group(groupName)).Returns(groups);

    //Act
    chatHub.Clients.Group(groupName).InvokeAsync("SendVisitorInfo", expectedName);

    // Assert
    Assert.Equal(expectedName, actualName);
}

Visual Studio generates next error message while running the test:

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : 'Moq.Language.Flow.ISetup' does not contain a definition for 'Returns'

In old versions mock clients creation looks like this:

var mockClients = new Mock<IHubCallerConnectionContext<dynamic>>();

But I can't use this interface now, so I tried:

var mockClients = new Mock<IHubClients>();

but it does't work

Sorry for my terrible english

i have a gridView and i have to make a cell editable based on the value of the cell beside of it. Like if the cell of second column is having "AF" value then the cell of the first column will become editable. I got the solution using CellClick event. But the problem is if try keyboard Down arrow or Enter button to go to next cell of the first column i am not able to make it editable.

This the code for cellClick event it is working fine.

private void  dgvForecastData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (GridRowIndex >= 0)
            {
                dgvForecastData.Rows[GridRowIndex].Cells["Forecast or Current Year Actual"].ReadOnly = true;
                string sActForecastIndicator = dgvForecastData.Rows[GridRowIndex].Cells["Actual/Forecast Indicator"].Value.ToString().Trim();
                if (sActForecastIndicator == "F" || sActForecastIndicator == "AF" && !dgvForecastData.Rows[GridRowIndex].Cells["Non recurring"].ReadOnly)
                {
                    dgvForecastData.Rows[GridRowIndex].Cells["Forecast or Current Year Actual"].ReadOnly = false;

                }


            }
        }

please tell me how can i achieve the above functionality using Keyboard(Down arrow and enter).

 private void GetTABLE()
    {
    conn.Open();
    cmd = new SqlCommand("`GetAllTablesProduct`", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable dt = new DataTable();
    da.Fill(dt);
    ListView1.DataSource = dt;
    ListView1.DataBind();
    conn.Close();
}

and This is Store Pro..

CREATE procedure [dbo].[GetAllTablesProduct]    
as    
Begin     
select * from Product    
ORDER BY ID DESC     
end 

I have a few textboxes gathering info all with validation controls in an asp net page.

When the page is fully valid i would like the user to download a file and show a panel box and hide the original. To do this i have

<script>
    $(function () {
        $('#<%=pnlDone.ClientID%>').hide();
        $('#<%=pnlOne.ClientID%>').show();

        if (Page_IsValid(""))

            $('#<%=Button1.ClientID%>').click(function () {
                setTimeout(function () {
                    $('#<%=pnlDone.ClientID%>').show();
                    $('#<%=pnlOne.ClientID%>').hide();
                }, 1000);
            });
    });
</script>

This worked well but the problem im now getting is the download file (in codebehind using a Response object) doesnt kick in since adding the above Jquery.

Taking the

if (Page_IsValid(""))

Out, resolves it but the (syntax to me looks correct, considering im not 100% fluent with Jquery) problem i then have is when the button is clicked it displays the pnlDone when the page isnt valid (i.e. textboxes are still to be filled).

How could i change this so if the page is valid then the download shows including the correct panel (remember removing the Page_Isvalid has the page working exactly the way i want)?

I know very few knowledge in ORM(Object Relation Mapping ) which creates database table and its entity as per Model if we follow MVC. But what i want is that database table will create dynamically after if user request and that according to the table name and the column given by the user on front end and create databse table should fallow the ORM relation mapping as normal ORM operation

listview assigned with dictionary value. While dropping the values the following event will raise. Here i need to get the values of the selected item.

if (data.GetDataPresent(typeof(Dictionary))) validation passed. But var info = data.GetData(typeof(Dictionary)) as Dictionary; returns null.

private void Canvas_PreviewDrop(object sender, DragEventArgs e)
    {
        var data = e.Data;
        Point p = e.GetPosition(UIRootCanvas);
        //    MainWindow parentWindow = Window.GetWindow(this) as MainWindow;

        if (data.GetDataPresent(typeof(Dictionary<string, Type>)))
        {
            var info = data.GetData(typeof(Dictionary<string, Type>)) as Dictionary<string, Type>;
            string qq = info.GetType().GetProperties()
                  .ToDictionary(x => x.Name, x => x.GetValue(info)?.ToString() ?? "").Values.ElementAt(0);
            if (qq == "checkbox")

            {
                CheckBox ss = new CheckBox();
                ss.Width = 20;
                UIRootCanvas.Children.Add(ss);
                Canvas.SetLeft(ss, p.X);
                Canvas.SetTop(ss, p.Y);
            }
        }
    }

I have a problem with SwingWorker. Currently, I have a model with an time consuming algorithm. I want to show the intermediate result of the algorithm in a specific view. So I have to use SwingWorker, because the GUI must update the value after each loop of the algorithm. The problem is the transfer of the value from the model to the GUI. Where can I insert the SwingWorker class and how can I transfer the data from the model to the view (over the controller), without adding to much "SwingWorker" logic into my model. Thank you for your help.