asp.net-mvc

Having classic ASP read in a key from appsettings in a web.config file

丶灬走出姿态 提交于 2021-02-07 08:44:46
问题 OK so here's the situation. I've got a classic ASP website running inside an MVC 4 application. I need the classic ASP website to be able to get a key from the appsettings section of the web.config file. Here is the function I've got: ' Imports a site string from an xml file (usually web.config) Function ImportMySite(webConfig, attrName, reformatMSN) Dim oXML, oNode, oChild, oAttr, dsn Set oXML=Server.CreateObject("Microsoft.XMLDOM") oXML.Async = "false" oXML.Load(Server.MapPath(webConfig))

Having classic ASP read in a key from appsettings in a web.config file

拜拜、爱过 提交于 2021-02-07 08:42:06
问题 OK so here's the situation. I've got a classic ASP website running inside an MVC 4 application. I need the classic ASP website to be able to get a key from the appsettings section of the web.config file. Here is the function I've got: ' Imports a site string from an xml file (usually web.config) Function ImportMySite(webConfig, attrName, reformatMSN) Dim oXML, oNode, oChild, oAttr, dsn Set oXML=Server.CreateObject("Microsoft.XMLDOM") oXML.Async = "false" oXML.Load(Server.MapPath(webConfig))

how to enable backspace,delete into maskededitextender date field

北城余情 提交于 2021-02-07 08:37:52
问题 I have a textbox as a date field . but due masked editor extender I can't edit dates in chrome or firefox backspace and delete is not working in chrome or firefox . codes are below <asp:TextBox ID="txtStartDate" CssClass="txtStartDate" runat="server" MaxLength="10" onkeydown="return allowBackSpace(event);" />  <asp:RequiredFieldValidator ID="startDateRequiredFieldValidator" runat="server" ValidationGroup="Dates" ControlToValidate="txtStartDate" EnableClientScript="True" Display="None" Text="*

Asp.net core Identity “The INSERT statement conflicted with the FOREIGN KEY constraint ”

混江龙づ霸主 提交于 2021-02-07 07:51:41
问题 I create ASP.NET CORE application with ASP.NET CORE Identity. I create seed class for saving new users and roles for first startup application. Inside this seed class I get following error when I add Role To User. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_AspNetUserRoles_AspNetUsers_UserId". The conflict occurred in database "DB_A14695_Elvinm", table "dbo.AspNetUsers", column 'Id'. The statement has been terminated. I used following class for Identity public class

Why is my MVC ViewModel member overridden by my ActionResult parameter?

百般思念 提交于 2021-02-07 07:17:38
问题 Is this a bug or a feature? All code below has been simplified for the sake of brevity and easy replication and does not actually do anything useful other than highlight the behavior. I have a class that includes an int named ID: public class FooterLink { public int ID { get; set; } } In my controller, I have an Edit actionresult that takes a parameter called 'id': public ActionResult Edit(int id) { return View(new FooterLink() { ID = 5 }); //notice that I am explicitly setting the ID value

Back button doesn't cause postback to a controller action in MVC

落爺英雄遲暮 提交于 2021-02-07 07:11:04
问题 When I click the back button in IE10 or Chrome on Win7, it does not hit my break point in my MVC controller. The Network tab in IE developer's tools shows it had a 304 not modified and Fiddler doesn't capture the request. I was expecting the post back, so I could do work in my controller. In my case, the bug is: Sign in make sure you are on the default page click the browser back button on the top left you'll now be back to the login screen sign in with your same credentials again when you do

Back button doesn't cause postback to a controller action in MVC

穿精又带淫゛_ 提交于 2021-02-07 07:10:39
问题 When I click the back button in IE10 or Chrome on Win7, it does not hit my break point in my MVC controller. The Network tab in IE developer's tools shows it had a 304 not modified and Fiddler doesn't capture the request. I was expecting the post back, so I could do work in my controller. In my case, the bug is: Sign in make sure you are on the default page click the browser back button on the top left you'll now be back to the login screen sign in with your same credentials again when you do

How to add a prefix to all actions with ASP.Net MVC URL Routing?

删除回忆录丶 提交于 2021-02-07 06:48:21
问题 I'm trying to write a MapRoute call that will make any route that is prefixed with "json/" prepend "json" to the action's name. For instance, a route something like this: "json/{controller}/{action}" with "json/Foo/Bar", it should result in: controller = "Foo" action = "jsonBar" Any ideas? 回答1: I wonder if it wouldn't be better to include json in the route-data and look it up in the action? i.e. when mapping your route, use something like (for the defaults): new { mode="json", controller =

Validation in ASP.NET Web Pages (Razor) deprecated?

孤街浪徒 提交于 2021-02-07 06:46:05
问题 I'm trying to use Validation in razor, but when I try to use the line Validation.RequireFields("firstName", "lastName", "dateOfBirth"); visual studio tells me: 'System.Web.Helpers.Validation' is obsolete: '"Use System.Web.HttpRequest.Unvalidated instead."' and 'System.Web.Helpers.Validation' does not contain a definition for 'RequireFields' but the most up to date reference I can find is http://www.asp.net/web-pages/overview/more-resources/asp-net-web-pages-api-reference#Validation and I don

How to prevent from DataAnnotations Attributes being deleted in DataBase First Model

╄→尐↘猪︶ㄣ 提交于 2021-02-07 05:43:04
问题 I have my asp.net mvc 3 application with entity framework and i used the Database First model to set it up. My Steps below: 1. Genarated a database with tables 2. Created ADO.NET Entity Data Model file (.edmx) and imported the tables 3. inside the design i added a Code Generation item and used ADO.NET DbContext Generator 4. a Model1.tt holder as been made with all of the tables Models I have edited the models and updated them with DataAnnotations Attributes (just for the example a well known