skip to Main Content

What is the lifetime of DbContext? – Asp.net

On Startup.cs, the application establishes connection with the database. services.AddDbContext<DataContext>(opt=> opt.UseSqlLite(_config.GetCinnectionString(‘DefaultConnectionString’)); }); This opt object of the now established database connection is injected as options to the DataContext class- public class DataContext:DbContext { public DataContext(DbContextOptions options):base(options) } And further on,…

VIEW QUESTION

Prevent html injection on Asp.Net textbox validation

I want to add a validator which prevents the html injection on Asp.Net injection. I am using the below code : <asp:TextBox ID="TxtBoxMultiLine" runat="server" TagName="textBoxValidation" Width="50%" AutoPostBack="False" autocomplete="off" textMode="MultiLine"></asp:TextBox> <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="HTML Tags Not Allowed" ControlToValidate="TxtBoxMultiLine" ClientValidationFunction="ValidateTitle" ValidationGroup="htmlValidation"></asp:CustomValidator> <asp:Button…

VIEW QUESTION
Back To Top
Search