Click here to Skip to main content
15,887,268 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the Pin
simpledeveloper23-Jan-19 16:55
simpledeveloper23-Jan-19 16:55 
GeneralRe: The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the Pin
simpledeveloper23-Jan-19 17:36
simpledeveloper23-Jan-19 17:36 
GeneralRe: The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the Pin
Nelek23-Jan-19 19:05
protectorNelek23-Jan-19 19:05 
QuestionOn web form button, prevent user from clicking the button more than 1 time Pin
dcof17-Jan-19 5:10
dcof17-Jan-19 5:10 
AnswerRe: On web form button, prevent user from clicking the button more than 1 time Pin
Richard MacCutchan17-Jan-19 5:20
mveRichard MacCutchan17-Jan-19 5:20 
Questionhow to Import Excel file into Data base using Entityframework in MVC Pin
Member 1408535316-Jan-19 17:55
Member 1408535316-Jan-19 17:55 
AnswerRe: how to Import Excel file into Data base using Entityframework in MVC Pin
Member 1408535316-Jan-19 18:03
Member 1408535316-Jan-19 18:03 
GeneralRe: how to Import Excel file into Data base using Entityframework in MVC Pin
Richard Deeming17-Jan-19 1:52
mveRichard Deeming17-Jan-19 1:52 
You do realise we can all see you talking to yourself, don't you? D'Oh! | :doh:

Quote:
string extension = ((System.Web.HttpPostedFileBase)value).FileName.Split('.')[1];

Lots of problems with that line. For example, what if the uploaded file doesn't contain an extension? What if it contains multiple "." characters? What if the extension is .lsx? Etc.

Try:
C#
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
    var file = value as System.Web.HttpPostedFileBase;
    if (file != null)
    {
        string extension = System.IO.Path.GetExtension(file.FileName);
        string[] allowedExtensions = Allow.Split(',');
        if (!Array.Exists(allowedExtensions, ext => string.Equals(ext, extension, StringComparison.OrdinalIgnoreCase)))
        {
            return new ValidationResult(ErrorMessage);
        }
    }
    
    return ValidationResult.Success;
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionASP.Net code won't run Pin
Member 1406015916-Jan-19 11:43
Member 1406015916-Jan-19 11:43 
AnswerRe: ASP.Net code won't run Pin
F-ES Sitecore17-Jan-19 0:15
professionalF-ES Sitecore17-Jan-19 0:15 
QuestionAn exception of type 'System.Data.Entity.Core.EntityException' occurred in EntityFramework.SqlServer.dll but was not handled in user code Pin
RedPandinus15-Jan-19 12:34
RedPandinus15-Jan-19 12:34 
AnswerRe: An exception of type 'System.Data.Entity.Core.EntityException' occurred in EntityFramework.SqlServer.dll but was not handled in user code Pin
Richard Deeming16-Jan-19 8:12
mveRichard Deeming16-Jan-19 8:12 
QuestionImport Tabulor form data from PDF file Pin
Member 1411436712-Jan-19 20:34
Member 1411436712-Jan-19 20:34 
AnswerRe: Import Tabulor form data from PDF file Pin
Richard MacCutchan12-Jan-19 22:54
mveRichard MacCutchan12-Jan-19 22:54 
GeneralRe: Import Tabulor form data from PDF file Pin
Member 1411436714-Jan-19 1:13
Member 1411436714-Jan-19 1:13 
GeneralRe: Import Tabulor form data from PDF file Pin
Richard MacCutchan14-Jan-19 1:46
mveRichard MacCutchan14-Jan-19 1:46 
GeneralRe: Import Tabulor form data from PDF file Pin
Nitin S25-Jan-19 1:40
professionalNitin S25-Jan-19 1:40 
QuestionWhat layers required for make asp.net core 2 project for prevent repeat data ? Pin
ahmed_sa2-Jan-19 21:53
ahmed_sa2-Jan-19 21:53 
AnswerRe: What layers required for make asp.net core 2 project for prevent repeat data ? Pin
Richard MacCutchan2-Jan-19 23:37
mveRichard MacCutchan2-Jan-19 23:37 
AnswerRe: What layers required for make asp.net core 2 project for prevent repeat data ? Pin
Vincent Maverick Durano3-Jan-19 22:35
professionalVincent Maverick Durano3-Jan-19 22:35 
AnswerRe: What layers required for make asp.net core 2 project for prevent repeat data ? Pin
James Walsh Jr12-Jan-19 5:47
professionalJames Walsh Jr12-Jan-19 5:47 
QuestionLossless Image compression Pin
Member 141024622-Jan-19 8:37
Member 141024622-Jan-19 8:37 
AnswerRe: Lossless Image compression Pin
Richard MacCutchan3-Jan-19 1:18
mveRichard MacCutchan3-Jan-19 1:18 
QuestionIs there any data mocking for calling Web API Put and post methods with C# Code Pin
simpledeveloper25-Dec-18 12:55
simpledeveloper25-Dec-18 12:55 
AnswerRe: Is there any data mocking for calling Web API Put and post methods with C# Code Pin
F-ES Sitecore30-Dec-18 5:41
professionalF-ES Sitecore30-Dec-18 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.