https://github.com/mgp25/WART

I have downloaded the Password generator from this Link.

But i am getting an error during Generation like this using my Number.

Could not request code using either SMS or voice

SMS: {"status":"fail","reason":"bad_token"}

Voice: {"status":"fail","reason":"bad_token"}

I searched online and found this link

http://www.17educations.com/whatsapp/how-to-get-whatsapp-id-and-password/

Even then I am getting same error.

I don't know why? Is there any other way to generate password?

In previous version of ASP.NET we could use "Server.ScriptTimeout" in controllers t ospecify timeout. How can it be done now in ASP.NET Core?

For example, I know that my page will require around 3-4 minutes to be run. Is it possible to avoid timeouts?

I'm doing an ASP.NET security WebSite for my school project..

I actually asked yesterday about SSL but i figured i should just go to Solution Explorer -> Project -> Properties -> Then set Enable SSL to True and allow VS to automatically assign for me a port to make my WebSite HTTPS. As you can see from my question yesterday i tried many methods to properly get my WebSite to be SSL, also saying it to be HTTPS.

Link to question Asked on Stackoverflow yesterday

This is what i meant about setting it to HTTPS

Now my query is that..

  1. How can i set the start up page to be HTTPS? To force my WebSite upon run to be https://localhost:28881/Example.aspx?

I did look at 2 questions on Stackoverflow,

First Question Second Question

But it doesn't seem to work at all..

Many have said to use the Project Property Pages

Here

But it doesn't seem to work for me as i get this error when i change the start up url to be what i want which is HTTPS and from the 2 questions above i linked, it still doesn't work.. And i get this error down below

Here

  1. How can i change the URL to be for example.. https://FinancialHub/Example.aspx, or something along the line of that? Instead of the usual, https://localhost:443..

I read on the web that this can be done by adding bindings in my applicationhost.config file, i tried but it didn't work.. It gives me the same error in the picture shown above.

To add on more information, i didn't add my website in IIS under Default Web Site, as i felt that it wasn't possible as mine was a WebSite not a Web Application and i didn't create a Virtual Directory as there is not a need for that.. Am i right? Please correct me.

I'm not too sure, or rather i'm not sure at all if i'm doing things correctly.

Would really appreciate any kind help please. Thank you!

I want to show Unicode character in RDLC Report that are come from Database. But I am unable to do this. Instead of Unicode come from database if I hard coded it in RDLC report then it display correctly. But when I bring the Unicode character from database and try to display then it is not working and nothing is shown.

May code is shown below

DataTable dt = SqlHelper.ExecuteDataTable((new CommonFunction()).connectionString(), CommandType.Text, "select Id, Name_In_Hindi from table1");
        if (dt.Rows.Count > 0)
        {
            ReportDataSource datasource = new ReportDataSource("DataSet1", dt);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(datasource);
            ReportViewer1.LocalReport.Refresh();
        }

Please some one help me it's urgent.

I have an ASP.NET webforms application (we'll call it outer) with another application living within it in a subsite (we'll call this one inner). The user logs into the outer application and is redirected to a page in the inner application. This seems to work. However, there is a button on the inner page that links back to another set of pages in a directory (/Main/Admin.aspx) on the outer site. When this linked is clicked, the user is logged out and hits the default login page for the outer site. Here's what I currently know:

  1. I get an event log entry for event code 4005 with a message of "Forms Authentication failed for the request. The ticket supplied was invalid." with an event detail code of 50201.
  2. I can see a 302 redirect in the web logs, sending them back to the login page.
  3. The web.config for /Admin only blocks unauthenticated users from hitting it.
  4. The outer site sets no policy for /Main or /Main/Admin.aspx.
  5. The inner site sets no policy for /Main or /Main/Admin.aspx.
  6. The server was recently upgraded from windows server 2008 to 2012 r2.
  7. I've tried not specifying the machine/decryption key, specifying it, and specifying it along with it varying between applications. I've been able to get messages indicating that it was unable to validate the ViewStateMAC, but no combination of settings I've found enables the redirect to work properly.

I'm stumped. This works on other machines, but on this one, the redirect is occurring and it is impossible to get to /Main/Admin.aspx.

Does anyone have any suggestions? I'm totally stuck on this one.

I have in my application ASP.net different styles that are loaded by bundles according to the configuration of each user. When I change login in the same browser, it works correctly, for each user a different style is seen, but the problem is: The idea is that the application is concurrent for several users and each has its session, I observed using different browsers that when logging in and loading the bundle for one user modifies the style of the session in another browser. Is there any way to isolate styles between sessions?

Using two types of SessionStates, for an On Premise environment InProc, for a cloud environment using Azure Redis Cache The bundles I declare according to the recommendation

  bundles.Add(New StyleBundle("~/bundles/Css").Include(hojaestilo,
                                                             "~/Content/jquery.calculator.alt.css",
                                                             "~/Content/jquery.treeview.min.css"))

        bundles.Add(New ScriptBundle("~/bundles/Jquery").Include("~/Scripts/jquery-1.5.2.min.js",
        "~/Scripts/jquery.validate.js",
        "~/Scripts/reports.js",
        "~/Scripts/jquery.validate.unobtrusive.js",
        "~/Scripts/globalize.js",
        "~/Scripts/cultures/globalize.culture.es-ES.js",
        "~/Scripts/gestion.js",
        "~/Scripts/jquery.cookie.min.js"))

        bundles.Add(New StyleBundle("~/bundles/CssJs").Include(hojaestilojs))
        bundles.Add(New StyleBundle("~/bundles/Estilos_imprimir").Include("~/Content/estilos_imprimir.css"))

        BundleTable.EnableOptimizations = True

Thanks

How do I insert database record (MySQL) in C# and Web Forms when JavaScript onclick event is triggered on the hyperlink ?

My code below I don't have error but the record not inserted.

In HTML view the value of :

a onclick="(<%=(rds.fields("foo").Value)%>)" href="....

is correct :

<a onclick="DataPrinted(CEF)" href=".... >

Thank you in advance for any help.

Javascript and Web Forms code

<script type="text/javascript">

    function DataPrinted(IDNumber) {

        xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST", "UpdateDataPrintStatus.aspx", true);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send("ID=" + IDNumber);
    }

</script>

<a onclick="DataPrinted(<%=(rds.fields("foo").Value)%>)" 
   href="javascript:document.getElementById('loading').style.visibility = 'visible';
   location.href='<%=rds.fields("link")%>';" target="_top" >
<%=rds.fields("foo")%>
<span>Test</span></a>

UpdateDataPrintStatus.aspx.cs

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
            string IDNumber = Request.Form["ID"].ToString();

            string query = String.Format(" INSERT INTO (IDNumber) ");
            query += String.Format(" VALUES ( ? ); ");

            using (OdbcConnection conn =
                new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString))
            {
                using (OdbcCommand cmd =
                    new OdbcCommand(query, conn))
                {
                    try
                    {
                        cmd.Connection.Open();
                        cmd.Parameters.AddWithValue("param1", IDNumber.ToString().ToUpper());
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        throw new ApplicationException("operation failed!", ex);
                    }
                    finally
                    {
                        cmd.Connection.Close();
                    }
                }
            }
        }
    }
 }  

System.InvalidOperationException: No database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions object in its constructor and passes it to the base constructor for DbContext.

Error image

StartUP Image

if (courseAssign.RemainingCredit>courseAssign.CreditToBeTaken) this Condition true then Need a confirmation Dialogue that show Yes/No option .... Here is My Code...

 [HttpPost]
  public ActionResult CourseAssignToTeacher(CourseAssignToTeachercourseAssign)
        {

            //if (courseAssign.RemainingCredit>courseAssign.CreditToBeTaken)
            //{
                //Need Code For Confirmation Dialog 
                 //if(YEs)
                 //    Continue Insert in database
                 //   else
                 //   break
            //}

            string msg = courseAssignToTeacher.Save(courseAssign);
            ViewBag.Messages = msg;
            return View();
        }

Current Repository Factory:

/// <summary>
/// Class used to init repositories
/// </summary>
public class RepositoryFactory
{
    public RepositoryFactory() { }

    public ISupplierRepository CreateSupplierRepository(IDatabaseUnitOfWork uow)
    {
        return new SupplierRepository(uow);
    }
}

As you can see I manually create every repository by creating new CreateRepository methods.

IoC Autofac

I am using Autofac in my ASP.NET MVC application and in the application start method I have a root container setup like below:

var builder = new ContainerBuilder();

// Register the controllers
builder.RegisterControllers(typeof(Catalogi.Web.CatalogiApplication).Assembly);

// Database Unit of work provider
builder.RegisterType<DefaultDatabaseFactory>().As<IDatabaseFactory>();
builder.RegisterType<PetaPocoUnitOfWorkProvider>().As<IDatabaseUnitOfWorkProvider>();
builder.RegisterType<RepositoryFactory>();

// Register all services op type RepositoryService
var dataAccess = AppDomain.CurrentDomain.GetAssemblies();
builder.RegisterAssemblyTypes(dataAccess)
    .Where(t => t.Name.EndsWith("Service") && t.BaseType == typeof(RepositoryService))
    .AsImplementedInterfaces();

// Build container
var container = builder.Build();

// Set resolver
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

There I register my RepositoryFactory which is then used by the service layers.

Base class for all services:

/// <summary>
/// Abstract base class for the services
/// </summary>
public abstract class RepositoryService : IService
{
    protected RepositoryFactory RepositoryFactory { get; set; }
    protected IDatabaseUnitOfWorkProvider UowProvider { get; set; }

    protected RepositoryService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory)
    {
        if (provider == null) throw new ArgumentNullException("provider");
        if (repositoryFactory == null) throw new ArgumentNullException("repositoryFactory");

        RepositoryFactory = repositoryFactory;
        UowProvider = provider;
    }
}

Here I inject everything using Autofac into the constructor.

Service layer interface:

/// <summary>
/// Service interface for working with the <see cref="ISupplier"/>
/// </summary>
public interface ISupplierService
{
    /// <summary>
    /// Get the supplier by Id
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    ISupplier GetSupplierById(int id);

    /// <summary>
    /// Save the Supplier
    /// </summary>
    /// <param name="supplier"></param>
    void Save(ISupplier supplier);

    /// <summary>
    /// Delete a supplier
    /// </summary>
    /// <param name="supplier"></param>
    void Delete(ISupplier supplier);
}

Service class:

/// <summary>
/// Supplier service
/// </summary>
public class SupplierService : RepositoryService, ISupplierService
{
    public SupplierService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory) : base(provider, repositoryFactory)
    {

    }

    /// <summary>
    /// Get the supplier by id
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public Models.ISupplier GetSupplierById(int id)
    {
        var uow = UowProvider.GetUnitOfWork();

        using(var repo = RepositoryFactory.CreateSupplierRepository(uow))
        {
            return repo.Get(id);
        }
    }

    /// <summary>
    /// Save the supplier
    /// </summary>
    /// <param name="supplier"></param>
    public void Save(ISupplier supplier)
    {
        using(var uow = UowProvider.GetUnitOfWork())
        {
            var repo = RepositoryFactory.CreateSupplierRepository(uow);

            repo.AddOrUpdate(supplier);

            uow.Commit();
        }
    }

    /// <summary>
    /// Delete the supplier
    /// </summary>
    /// <param name="supplier"></param>
    public void Delete(ISupplier supplier)
    {
        using (var uow = UowProvider.GetUnitOfWork())
        {
            var repo = RepositoryFactory.CreateSupplierRepository(uow);

            repo.Delete(supplier);

            uow.Commit();
        }
    }
}

My questions are:

1) Am I using the IoC in a correct way?

2) Can the RepositoryFactory class be changed by using Autofac to resolve repositories when we need them in the service layer?

3) Is it a good aproach to work with a repository factory, or is it better to just inject the needed repositories in the constructor and add the repositories in the root container of Autofac?

I am working with an ASP.net web API project.I can download blobs one by one from azure storage account.But i want to download collections of blobs after compressing or while compressing.I have tried this by using following code segments.But the thing is it shows a exception like this. "Access to the path 'C:\Users\SomeUser\text1.txt' is denied"

`       string code = "EZCMP1/EZUSR-9";
        string blobcontainerName = "ezcmp1voucherblobcontainer";
        MemoryStream ms1 = new MemoryStream();
        var blobFileNames = new string[] { "file1.png","file2.png","file3.png","file4.png" };
        string storageConnectionString = ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString.ToString();
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobClient.GetContainerReference(code.Split('/')[0].ToLower() + blobcontainerName.Replace(@"\s+","").ToLower() + "blobcontainer");
        string fileName = @"C:\Users\SomeUser\text1.zip";
        Directory.CreateDirectory(Path.GetDirectoryName(fileName));
        using(var fs = new FileStream(fileName,FileMode.Create))
        {
            fs.Position = 0;
            int cnt = 0;
            foreach(string t in blobFileNames)
            {
                var ms = new MemoryStream();
                container.GetBlockBlobReference(t).DownloadToStream(ms);
                ms.Position = 0;
                cnt++;
            }
            ms1.Position = 0;
            ms1.CopyTo(fs);

        }`

I have a simple web method like this (inside file service.asmx):

<WebMethod()> _
Public Shared Function test(Name As String) As String
    Return Name
End Function

I want to be able to Invoke this method with a GET request, so I will be able to retrieve data using URL for example http://localhost:52268/service.asmx/test?Name=Jacob And I want it to return json data that will be displayed on the browser I red about UseHttpGet so i did this:

<WebMethod()> _
<ScriptMethod(UseHttpGet:=True)> _
Public Shared Function test(Name As String) As String
    Return Name
End Function

and in my web config file I added:

<system.web>
<webServices>
  <protocols>
    <add name="HttpGet"/>
  </protocols>
</webServices>
...
<system.web>

But when hitting the url http://localhost:52268/service.asmx/test?Name=Jacob it doesn't seem to do anything, it just refreshes the page (also cannot hit breakpoint in the code) any help?

Guys I am trying to remove default applied styles to the Validation Controls in asp.net. I am used Theam and set it Web.config still it applying.

How can i FIx

This should be fairly trivial, yet, it's not. I'm trying to use a Razor helper to output a bunch of links, but the syntax appears to become inherently ugly. Can someone with good Razor knowledge help me clarify how to remove <text> tags and potentially balance the tags so I can get rid of the Raw() output?

@helper LinkBuilder(string linkText, string action, string controller, List<string> controllersGroup = null) {
bool userHasAccess = securityEngine.HasAccess(userRoles, controller.ToLower(), Permission.View);

<text></text>   @* Razor demands some output first *@

if (userHasAccess == false) {
    <text><li class="disabled" style="@(listItemWidth)"></text>
}
else {
    <text><li style="@(listItemWidth)"></text>
}

if (userHasAccess) {
    @Html.ActionLink(linkText, action, controller)
}
else {
    <span title="@i18n.NoAccess">@linkText</span>
}

@Html.Raw("</li>") @* Without Html.Raw, Razor complains about unmatching tags *@

}

The idea is to build a menu using code like this:

    <ul>
        @LinkBuilder(i18n.Documents, "Documents", "Product")
        @LinkBuilder(i18n.Reports, "Index", "Report")
        @LinkBuilder(i18n.Committees, "Index", "Committee", new List<string> { "Company", "Person" })
    </ul>

I am really new in ASP.NET and C# so please be patient.

I develop an application. I have full access to the production database.

Since now I used only my tables, but now I need to use a table where are production data.

I've created a new database and added a new connection string to Web.config file.

So the production connection string names are:

Prod: myconnectiond
Dev:  devconnection

My goal is to use the devconnection while I develop.

I've put it this into my database connect method:

if (Environment.MachineName.ToLower() == "mymachine" && connectionName == "myconnection") {
    connectionName = "devconnection";
}

Is it a good practice, or does exists better?

I understand that this question has been asked several times already and I have looked at a lot of the questions, but none of the answers have worked for me thus far.

I am working with an ASP.Net WebAPI 2 Controller using .Net 4.5.2 and posting using Ajax.

I immediately get a 404 error, however looking at insights it shows that there are x amount of requests to that controller and that action\method but its returning a 404 immediately.

This is the the method, and would be grateful if anyone could help me.

 [System.Web.Mvc.HttpPost()]

 public int InsertRecord(Models.Person model)
    {

        if (ModelState.IsValid)
        {
            var person = new Person
            {
                FirstName = model.FirstName,
                LastName = model.LastName,
                DateOfBirth = Convert.ToDateTime(model.DateOfBirth)
            };

            _dbContext.People.Add(person);
            _dbContext.SaveChanges();

            var id = person.P_id;

            return id;
        }
        else
        {
            throw new Exception("Invalid Data", null);
        }
    }

which is being called from my Ajax as follows;

 $("#btnSave").click(function () {

    $('#FirstName').valid();
    $('#LastName').valid();
    $('#DateOfBirth').valid();

    if ($('#FirstName').valid() &&
        $('#LastName').valid() &&
        $('#DateOfBirth').valid()) {
        //console.log("save clicked");
        var jsonData = {
            firstName: $('#FirstName').val(),
            lastName: $('#LastName').val(),
            dateofBirth: $('#DateOfBirth').val()
        }

        $.ajax(
            {
                type: "POST", //HTTP POST Method  
                url: "http://localhost:56658/AddPerson/InsertRecord", // Controller/View   
                data: jsonData,
                success: function (response) {
                    if (response != null && response.success) {
                        alert(response.responseText);
                    } else {
                        // DoSomethingElse()
                        alert(response.responseText);
                    }
                },
                error: function (response) {
                    alert("error!");  // 
                    console.log(response);
                }

            });
        return false;
    }



});

Edit

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

        routes.MapRoute(
            name: "AddPerson",
            url: "{controller}/{action}",
            defaults: new { controller = "AddPerson", action = "InsertRecord"}
        );
    }
}

Edit 2

This is the global asax file contents

protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

    }

This is my _ViewStart.cshtml:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

This is my _Layout.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">


    <!-- Lots of tags for dependencies -->

</head>
<body>
    <div class="container body-content">
        @RenderBody()
        <div class="divider row top-buffer"></div>
        <footer>
            <p>&copy; @DateTime.Now.Year - MyApp</p>
        </footer>
    </div>
</body>
</html>

This is my Index.cshtml:

@Html.RenderApiEndpoints()
<script type="text/javascript" src="~/Content/index.js"></script>

    <div ng-app="app">
        <div ng-view ></div>
    </div>

I am fetching Index.cshtml like:

public class HomeController : Controller
    {
        [Route("")]
        public ActionResult Index()
        {
            return View();
        }
    }

Since I am using client-side routing with Angular $routeProvider, I am always in Index.cshtml. Furthermore, I don't need a Layout, I just need my Index.cshtml.

How can I avoid using a Layout-File and directly start with my Index.cshtml when going to localhost in browser?

I have this extract from my Razor display layout:

...more controls here
    <div class="control-group">
     @Html.LabelFor(model => model.BankAccountType, new { @class = "control-label" })
      <div class="controls">
        @Html.DisplayFor(model => model.BankAccountType)
        @Html.DisplayFor(model => model.AccountTypeValid)
      </div>
    </div>
...more controls here

This is the display template I have for AccountTypeValid:

@model string
@if (Model == "Y")
{
    <i class="fa fa-check"></i>
}
else if (Model == "U")
{
    <i class="fa fa-question"></i>
}

It renders like this:

fa images appear on a new line

How do I get the fa images to appear in-line with the text value?

I am new to ASP.NET programming and I encounter some problem, maybe someone can help me to find the solution.

I followed and completed the procedure here BeginForm with IEnumerable. But when I tried to run my codes. Something error happens on browser. The error is:

The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[ek_oms.Models.AddCategoryViewModel]', but this dictionary requires a model item of type 'ek_oms.Models.AddCategoryViewModel'.

Here's my related codes to that part.

Class:

public class AddCategoryViewModel
{
    public IEnumerable<CategoryViewModel> CurrentCategories { get; set; }
    public CategoryModel NewCategory { get; set; }
}

Partial codes in View:

@model ek_oms.Models.AddCategoryViewModel
@if (Model.CurrentCategories != null)
{
    foreach (var item in Model.CurrentCategories)
    {
        <tr>
            <td>@item.CategoryName</td>
            <td>
                @using (Html.BeginForm("CategoryDelete", "Admin", new { catID = item.Id }, FormMethod.Post, null))
                {
                    @Html.AntiForgeryToken()
                    @Html.ActionLink("Edit", "CategoryEdit", null, new { catID = item.Id }, new { @class = "btn btn-primary btn-xs" })
                    <button type="submit" class="btn btn-danger btn-xs" onclick="return confirm('Are you sure you want to delete record with Category = @item.CategoryName')">Delete</button>}
            </td>
        </tr>
    }
}

<div class="tab-content">
    @using (Html.BeginForm("Categories", "Admin", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" }))
    {
        @Html.AntiForgeryToken()
        <div class="box box-primary">
            <!-- /.box-header -->
            <div class="box-body">
                <div class="box-header">
                    <h3 class="box-title">Add New Category</h3>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            @Html.EditorFor(model => model.NewCategory.CategoryName, new { htmlAttributes = new { @class = "form-control", id = "Category", @placeholder = @Html.DisplayNameFor(model => model.NewCategory.CategoryName) } })
                            @Html.ValidationMessageFor(model => model.NewCategory.CategoryName, "", new { @class = "text-danger" })
                        </div>
                        <div class="form-group">
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-footer">
                <button type="submit" class="btn btn-primary" id="submitAddCatBtn">Add</button>
            </div>
        </div>
    }
</div>

Controller:

public async Task<ActionResult> Categories()
{
    ViewBag.Message = TempData["Message"];
    ViewBag.CatUsedMessage = TempData["CatUsedMessage"];

    HttpResponseMessage responseMessage = await client.GetAsync(urlProducts + "/categories");
    if (responseMessage.IsSuccessStatusCode)
    {
        var responseData = responseMessage.Content.ReadAsStringAsync().Result;
        var categories = JsonConvert.DeserializeObject<List<AddCategoryViewModel>>(responseData);
        return View(categories);
    }
    return View("Error");
}

Can someone help me to this. I don't know the right term to start searching. Thanks.

I'm developing a web application (ASP.Net Core) in a servicefabric cluster, but every time I get an error in a razor view (for example a variable not set) I get a 404 error and not the well known error page which tells me what is wrong.

I have no clue as to why it does that or how I should solve it and can't find anything online. Can anyone point me in the right direction?

The project used to run outside the cluster and debugging worked there but since it's in the cluster it doesn't.

I've been trying to perform Logout operation (Form Authentication with cookies) but unable to call the POST Logout action method.

Here's my Partial View:

<nav class="navbar navbar-inverse" role="navigation">
  <div class="container">
    <div class="nav navbar-nav navbar-right">
      @using (Html.BeginForm("Logoff", "Account", FormMethod.Post, new { id = "logoutForm" })) 
     { 
     @Html.AntiForgeryToken()
      <a class="navbar-brand" href="javascript:document.getElementById('logoutForm').submit()" title="Logout">
        <img alt="Home" src="@Url.Content(" ~/Images/logout.png ")"/>

      </a>
      }

    </div>

  </div>

</nav>

I'm calling this partial View in below Home page as header:

<header role="banner">

    @Html.Partial("_HomeHeader")

</header>

<div class="container">
.......
</div>

In my account controller, I've defined following action method:

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Logoff()
{    
      FormsAuthentication.SignOut();
      Session.Clear();
      return Redirect(FormsAuthentication.LoginUrl);                
}

Thus, on clicking the Logout button from the home page, it should Go to the "Logoff" action method and clear the cookies and then redirect to Login Page. But it doesn't work. Instead, it goes to the Login page directly without visiting the Logoff action method. I got this URL: http://localhost/Account/Login?ReturnUrl=%2FAccount%2FLogoff

Can anyone please provide their inputs regarding how to achieve this functionality?