I am trying to scrap a website with an asp form. There is an image input, which has no onclick or any tag to it, so I dont know what is it calling on a click. Still if I click on it, it downloads a file. What does exactly triggers the download. I was thinking about async jquery but really could not find a solution. The html tag of the input looks the following:

<input type="image" name="ctl00$ContentPlaceHolder1$rptItem$ctl00$lnkStatus" 
src="images/download.ico" style="border-width:0px;height:30px;border- 

And from the posted headers I can not see anything which would trigger a download. I dont really see what could cause a download to happen. Thanks for the help in advance.

In my project I am converting image into bytes. After converting into bytes, I have found that the byte size is around 30,000 to 50,000 bytes. Is it fine to store this much amount of bytes in Session? Is it going to effect the application performance?

I face problem when ex: (customers login to their dashboard after that if they type in url Admin/Admindash ... this will redirect them to admin dashboard and my website consider them admin and) although I set the authorization role to each action [Authentication(Role="customer")] also in login i check roles


    <authentication mode="Forms">
      <forms loginUrl="AppLogin.cshtml"   
      name=".ASPNETAUTH" protection="None" path="/" timeout="20" />  
      <deny users="?"/>

  <location path="Home.cshtml">
        <allow users="*"/>

//login controller check roles

Session["userEmail"] = validateUser;
  System.Web.HttpContext.Current.Application[""] = "";

 System.Web.HttpContext.Current.Application["timeout"] = DateTime.Now.ToString();
                    if (validateUser.Role.Equals("user", StringComparison.InvariantCultureIgnoreCase))
                        return RedirectToAction("Personal", "Dash");
                    else if (validateUser.Role.Equals("Business", StringComparison.InvariantCultureIgnoreCase))
                        return RedirectToAction("Dashboard", "Business");
                    else if (validateUser.Role.Equals("Telecom", StringComparison.InvariantCultureIgnoreCase))
                        return RedirectToAction("Dashboard", "Telecome");
                    else if (validateUser.Role.Equals("Admin", StringComparison.InvariantCultureIgnoreCase))
                        return RedirectToAction("AdminDashboard", "Admin");
                    else if (validateUser.Role.Equals("IdOperator", StringComparison.InvariantCultureIgnoreCase))
                        return RedirectToAction("Dashboard", "IdOperator");
                        return RedirectToAction("Errorpage404", "Website");

strong text

private Employee GetEmployee(){

        return new Employee()

}; }

Environment:Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0

Backend: Oracle 9i

Tools : Visual Studio 2012, ODAC 11.2 Version

The application works fine when I debug through Visual studio 2012 and all CRUD operation works perfectly.

But when I deploy it to the IIS server it said "ORA-03134: Connections to this server version are no longer supported as in below image"

enter image description here

IIS configuration(Application Pool) is as follows :

enter image description here

I'm trying to setup a dev environment for an asp.net (umbraco) project using IIS Express on a mac. I have a VM with windows installed with the dev tools.

My goal is to only use the VM as a compiler but actually write the code on the mac. To do that my trying to setup a network drive or a shared folder between the host and the guest OSes.

But IIS Express gives me an error when running the application.

HTTP Error 500.19 - Internal Server Error

The Requested page cannot be accessed because the related configuration data for the page is invalid.

Error Code 0x80070003

Config Error Cannot read configuration file

I kind think it has something to do with the settings of permission but I'm not sure. But I do not have that great understand of the permission system in windows or of how IIS Express actually works.

I am trying to show the email client (web or outlook) through my pixle image link . It is working fine when uer open their mail from web. But when they open pixle link from Outlook, then following field show "Unknown" , in asp.net :

HttpRequest moRequest = HttpContext.Current.Request;// request ?? Request; HttpBrowserCapabilities bc = moRequest.Browser [Unknown] outlook case

Please suggest as what is the best way to show it "Outlookk" also when email open from recipient

We are facing problem, On button click, we set cookies & we refresh page using jquery, but after page loads, we get to see older version of javascript is loaded.

Note: 1. We've already searched for all the links where hardcoded could be written, not found. 2. Versioning of javscript is done from web.config. 3. Thanks in advance

My view model:

public class FileInfo
    [StringLength(50, ErrorMessage = "TitleErrorMessage", MinimumLength = 2)]
    public string Title { get; set; }

    [StringLength(100, ErrorMessage = "DesErrorMessage", MinimumLength = 3)]
    public string Description { get; set; }

    public IFormFile File { get; set; }

The following is _UploadForm partial view file:

@model SessionStateTest.Models.FileInfo

<div class="form-group">
    <input class="form-control" asp-for="Title" />
<div class="form-group">
    <input class="form-control" asp-for="Description" />
<div class="form-group">
    <input type="file" asp-for="File" />

That is used in another View with this code:

<form asp-action="AddUploadForm" asp-controller="Home" method="Post">
    <input type="submit" value="Add another file" class="btn btn-sm btn-primary" />
<form asp-action="Upload" asp-controller="Home" method="Post" enctype="multipart/form-data">

    @foreach (var item in Model.Upload)
        @(await Html.PartialAsync("_UploadForm", item))

    <div class="col-xs-12">
        <input type="submit" value="Upload" class="btn btn-sm btn-info" />

Basically AddUploadForm action adds a new view model of type FileInfo to Model.Upload which is my main view model. The problem is that the list List<FileInfo> vm in Upload action below is totally empty:

    public IActionResult Upload(List<FileInfo> vm)
        .... some other logic 
        return View();

I don't want to use multiple attribute because I would like to force user to provide a title and description for every file.

Any help is kindly appreciated!

enter image description here

As you see in attached image, I have four tables one for Departments one for Categories one for Products and last one InventoryTable

Departments { DeptId, DeptName }
Category {CatId, CategoryName}
Product {PrId, PrName, CatId}
And Inventory {InventoryId, ProductId, DepartmentId, Status}

And I want to create a table that shows as attached image shows. I want to show status of every product in every department and total of that product.

This is my Model and Right now I only able to show products and total product of that specifik product But I want to put even Department names between Product and total and show even Departments status Those Departments does not need to be dynamical. But How do I reach this kind of table ...

This is my Model

public class SummeryOfInventoryModel
        public Product product { get; set; }
        public string productName { get; set; } 
        public int ProductId { get; set; }

        public Department department { get; set; }
        public string DepartmentName { get; set; } 
        public int DepartmentId { get; set; }

        public int Status { get; set; }


And this is How I'am trying to do Action Controller

        public async Task<ActionResult> GetProductSummery()
            using (context)                                 
                return (PartialView("_ProductSummery", await context.Inventory
               .Include(p =>p.Product).Include(d =>d.Department)
               .GroupBy(m => m.Product.PrName)
               .Select(g => new SummeryOfInventoryModel { productName = g.Key, Status = g.Sum(c => c.Status) })


But this givs me only Productname and total statuse of that product like this

Product  Totaly 
Audio       25
Ford        10   

But what Iwant is

Product Ny  Paris   Berlin  Total
Audio   20  5                25
Ford    10                   10
Volvo       15         10    25 

And this is my PartielView:

@model IEnumerable<Lager03.Models.SummeryOfInventoryModel>


<table class="table">






    @foreach (var item in Model)

            @Html.DisplayFor(modelItem => item.ProductName)



            @Html.DisplayFor(modelItem => item.Status)



Please Help, I would appreciate your help, Thank you

I need to migrate from SQL Server to Elasticsearch. Hence wanted to know whether it is feasible to use Elasticsearch with .Net Core 2.2. If yes, an example for configuring a simple fetch query API would be helpful.

I want to know how to expand and collapse treeview when the Parent node is clicked all the node inside the parent is expanded and vice versa using javascript.

As per screen shot below when user clicks the HeadNode1 all its Child and GrandChild node is Expanded and viceversa.

enter image description here

My Treeview

asp:TreeView ID="TreeView1" onclick="ClientSideChangeSelection()" ShowCheckBoxes="All" Showlines="true" runat="server"></asp:TreeView>
            <asp:Button ID="Button1" runat="server" OnClick="Save_Click" Text="Save" />

CS code

 protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                TreeNode tNode1 = new TreeNode();
                tNode1.Text = "HeadNode1";
                tNode1.Value = "HeadNode1";

                TreeNode h1ChildNode1 = new TreeNode();
                h1ChildNode1.Text = "Head1Child1";

                TreeNode h1GrandChild1 = new TreeNode();
                h1GrandChild1.Text = "Head1Child1Grand1";

                TreeNode h1ChildNode2 = new TreeNode();
                h1ChildNode2.Text = "Head1Child2";

                TreeNode h1ChildNode3 = new TreeNode();
                h1ChildNode3.Text = "Head1Child3";

                ServerSideChangeSelection(TreeView1, true);
                List<TreeNode> nodes = new List<TreeNode>();

                foreach (TreeNode node in TreeView1.Nodes)
                    if (node.ChildNodes.Count > 0)
                        foreach (TreeNode childNode in node.ChildNodes)

                Nodes = nodes;

I expect to click my parent and see the node get expanded if it has any children in it .

Thank you for your time.

I know how to look into folders with Directory.GetFiles, and how to use FileInfo for file information, but I can't figure out how to put these concepts together. When I looked up the Directory class I could only get filenames so I'm stuck, I can only get the gridview to make a 1 dimensional table but I need 3 columns for the info stated in title. I'm new to asp.net/c# I'm sorry if the answer is right in my face. Any help greatly appreciated.

//If there are any files in the folder, get info of file
    if (Directory.GetFiles(folderpath).Length > 0)
        String name = FileUpload1.FileName;
        //provide file path, the name of file, then grab info of file
        FileInfo file = new FileInfo(folderpath + FileUpload1.FileName);
        //testing if we retrieved info 
        Label1.Text = ("Name :" + file.Name + "<BR/>" + "Size :" + file.Length + "<BR/>" + "Modified :" + file.LastWriteTime + "<BR/>");

        string[] allfiles = Directory.GetFiles(folderpath, "*");
        grdFile.DataSource = allfiles;

The code snippet is more me showing my current understanding, not necessarily a proper attempt at what I am trying to do.

I have a legacy asp.net webforms site that awhile ago had mvc worked into it. All the mvc works fine so I thought that adding a new controller to call from jquery would be easy. Not so much. Everything I find through google or here on SO gives me either solutions for .net CORE which this isn't or the code below. But the code below is not working and I don't know what else to do.


        <clear />
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET,POST" />
        <add name="Access-Control-Allow-Headers" value="X-AspNet-Version,X-Powered-By,Date,Server,Accept,Accept-Encoding,Accept-Language,Cache-Control,Connection,Content-Length,Content-Type,Host,Origin,Pragma,Referer,User-Agent" />

add a cors action filter attribute

public class AllowCrossSiteJsonAttribute : ActionFilterAttribute
    public override void OnActionExecuting(ActionExecutingContext filterContext)
        filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");

use it in the controller

public JsonResult all(QuoteRequest request)
    return Json(new QuoteResponses
        ExpressQuote = express(request),
        PremiumQuote = premium(request),
        CorpToCorpQuote = corptocorp(request)

What's very strange is if I call this endpoint through postman with a regular post it works fine. However, calling it with jquery's post gives me the cors error...

Access to XMLHttpRequest at 'xxxxxxxxx' from origin 'xxxxxxxx' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

What else can I do or try?

I write a demo program, to use .NET Framework Web Api2. For some reason, I have to use .NET Framework rather than .Net Core. But I've got a problem, how to modify the port? It's always 57518. I want to change it.

This question already has an answer here:

So I am getting this error when I run my asp.net project.

errorSystem.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Product_ProductTypes". The conflict occurred in database "ShoppingDB", table "dbo.ProductTypes", column 'Id'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.b__c(DbCommand t, DbCommandInterceptionContext1 c) at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary2 identifierValues, List1 generatedValues) at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update() --- End of inner exception stack trace --- at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update() at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.b__2(UpdateTranslator ut) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func2 updateFunction) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update() at System.Data.Entity.Core.Objects.ObjectContext.b__35() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction) at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.b__27() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation) at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction) at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options) at System.Data.Entity.Internal.InternalContext.SaveChanges() --- End of inner exception stack trace --- at System.Data.Entity.Internal.InternalContext.SaveChanges() at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() at System.Data.Entity.DbContext.SaveChanges() at fyp.ProductModel.InsertProduct(Product product) in c:\Users\Suren\Documents\Visual Studio 2012\Projects\fyp\fyp\ProductModel.cs:line 16

I have a standard ASP.Net web forms page, which has a textbox, dropdownlist and a range validator on it.

When the selected item in the dropdown list is changed i call a javascript function "ChangeRange" (Which i can see being called!)

However, when i change the Maximum and Minimum values via javascript the range update is not taking effect.

I have tried calling ValidatorValidate(myVal) and Page_ClientValidate(null) to trigger the validation to be called but its not working.

I can however see that the text of the validator is being updated.

function ChangeRange(rng) {

     //range validator
     var rangeVal = document.getElementById(rng);

     var upperRange = 100;
     var lowerRange = 1;

     rangeVal.innerHTML = " must be between " + lowerRange.toString() + " and " + upperRange.toString()
     rangeVal.MaximumValue = upperRange.toString();
     rangeVal.Minimumvalue = lowerRange.toString();


I expect the range to update, however this is not happening at the moment. I feel i am missing something obvious!

I want to create a dynamic access level, but I have no idea how to do it. I need to fully dynamically navigate the menus and buttons of the site, but I do not know if I could do this. I mean more buttons. For example, the delete and edit button, and the update button.

Please guide me to get a good idea.

ASP>NET Problem: I Want to add my string value in my navigation bar How Can I get this ?? Thanks In Advance code: __________________________________________________________________enter image description here

So I have a FormView where I need to update a form and it keeps saying that i need the itemupdating event.

I call the update on button click

    protected void btnValidarFormulario_Click(object sender, EventArgs e)
            catch(Exception ex)
                ScriptManager.RegisterStartupScript(this, this.GetType(), "key_name", "ShowToast('Erro', 'topCenter', 'error', 'Falha na ligação à base de dados. tente novamente mais tarde', 2000);", true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "key_name", "ShowToast('OK', 'topCenter', 'success', 'Registo validado com sucesso', 2000); setTimeout(function(){window.location.href ='../Inicio.aspx'}, 2000);", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowToast('Atenção', 'topCenter', 'warning', 'Preencha todos os campos com dados válidos.', 2000)", true);

and on sqldatasource updated event i do a few more stuff

   protected void sdsADefinicao_Updated(object sender, SqlDataSourceStatusEventArgs e)
        int id = Convert.ToInt32(e.Command.Parameters["@ReturnStatus"].Value);

        FileUpload fuAnexo = fvADefinicao.FindControl("fuAnexo") as FileUpload;

        int numFiles = fuAnexo.PostedFiles.Count;
        int index = 0;
        Ficheiro[] files = new Ficheiro[numFiles];

        foreach (HttpPostedFile file in fuAnexo.PostedFiles)
            Ficheiro anexo = new Ficheiro("application/pdf", "HUTMATER");
            anexo.Nome = Path.GetFileName(file.FileName);
            using (Stream fs = file.InputStream)
            using (BinaryReader br = new BinaryReader(fs))
                anexo.Dados = br.ReadBytes((Int32)fs.Length);
            files[index] = anexo;

        string piloto = SessionManager.Nome;
        Ficheiro.Upload(id, piloto, files); // Guarda anexos do formulario na base de dados            

                ConnectionString="<%$ ConnectionStrings:ValidacaoFormas_ConnectionString %>"

                    <asp:ControlParameter ControlID="hdfRegistoID" Name="RegistoID" Type="Int32" />

                    <asp:Parameter Name="Base_Cru" Type="String" />
                    <asp:Parameter Name="Linha_Cru" Type="String" />
                    <asp:Parameter Name="Marcacao_Continua_Cru" Type="String" />
                    <asp:Parameter Name="Diametro_Cru" Type="Decimal" />
                    <asp:Parameter Name="Espessura_Cru" Type="Decimal" />
                    <asp:Parameter Name="Comprimento_Cru" Type="Decimal" />
                    <asp:Parameter Name="ReturnStatus" Type="Int32" Direction="Output" />
                    <asp:ControlParameter ControlID="hdfRegistoID" Name="RegistoID" Type="Int32" Direction="Output" />

I even tried creating an onItemUpdating event without anything and still gave me the same error that itemupdating event was not processed. I can do an insert on formview just using sqldatasource without any insert from formview events. Why can't i do the same on update on form view?

    Style="width: 100%; max-width: 1200px;">