asp.net-4.0

How to Update (Add/Modify/Delete) keys in AppSettings section of web.config at runtime

爱⌒轻易说出口 提交于 2019-12-01 04:37:52
I like to Update keys/Values defined in AppSettings section of Web.config at runtime. however I DO NOT want to actually save them to Web.config file. I have a huge web application that have consists of many modules, DLLs and source code files. A bunch of critical information ranged from database configuration, encryption keys, username and passwords for webservices are saved in AppSettings section of the web.config file. Recent project requirement needs me to move these values out of web.config and keep in a secure storage. I already secured these values in an external location and I can read

Detect browser refresh

时光毁灭记忆、已成空白 提交于 2019-12-01 03:24:40
问题 How can I find out if the user pressed F5 to refresh my page (Something like how SO implemented. If you refresh your page, the question counter is not increased). I have tested many code snippets mentioned in a dozen of tutorials, but none worked correctly. To be more clear, suppose that i have an empty web form and would like to detect whether the user has pressed F5 in client-side (causing a refresh not submit) or not. I can use session variables, but if the user navigates to another page

How to Update (Add/Modify/Delete) keys in AppSettings section of web.config at runtime

时间秒杀一切 提交于 2019-12-01 02:53:01
问题 I like to Update keys/Values defined in AppSettings section of Web.config at runtime. however I DO NOT want to actually save them to Web.config file. I have a huge web application that have consists of many modules, DLLs and source code files. A bunch of critical information ranged from database configuration, encryption keys, username and passwords for webservices are saved in AppSettings section of the web.config file. Recent project requirement needs me to move these values out of web

ASP.NET Forms Authentication

牧云@^-^@ 提交于 2019-12-01 01:15:19
I have the following ASP.NET Forms Authentication configuration: <system.web> <authentication mode="Forms"> <forms name="MembershipCookie" loginUrl="Login.aspx" protection="All" timeout="525600" slidingExpiration="true" enableCrossAppRedirects="true" path="/"> </forms> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> <location path="Home.aspx"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location If an anonymous user visits the site and requests home.aspx should they be denied access and kicked to the Login.aspx page

IIS7 Web.Config Caching - what are the differences here, and how does it all come together?

白昼怎懂夜的黑 提交于 2019-12-01 00:15:24
问题 In IIS7 I've got the ability to set caching options. These options are added to my web.config as such... <caching maxCacheSize="262144"> <profiles> <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" /> <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" /> <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" /> <add extension=".css"

ServiceStack with IIS 7.5

☆樱花仙子☆ 提交于 2019-11-30 19:24:34
I installed Clean Windows Web Server 2008 R2 64-bit with IIS 7.5. I created .NET v4.0 application pool and Web Site in this pool, where I deployed my application with ServiceStack services. I got this error message in web browser when I opened servicestack page.: HTTP Error 500.21 - Internal Server Error Handler "ServiceStack.Factory" has a bad module "ManagedPipelineHandler" in its module list. My application is working in Visual studio hosted IIS server. Can be problem with IIS 7.5 instalation and servicestack or it is some asp.net issue? 1) Ensure the following is in the web.config <!--

New window opens on click of actionLink

我与影子孤独终老i 提交于 2019-11-30 17:14:01
问题 I have a requirment to invoke a controller method from the view page. On click of the link below the method should be invoked. @Html.ActionLink(item.InvoiceNumber, "SendPdfStatement", "Invoice", new { item.InvoiceNumber }, new { target = "_blank" }) the method signature is as: public void SendPdfStatement(string InvoiceNumber) { InvoiceNumber = InvoiceNumber.Trim(); ObjectParameter[] parameters = new ObjectParameter[1]; parameters[0] = new ObjectParameter("InvoiceNumber", InvoiceNumber); List

The directory '/website/App_Code/' is not allowed because the application is precompiled

孤街醉人 提交于 2019-11-30 16:49:51
How can I resolve the below issue that I get when I am running my precompiled web app? Server Error in '/CRM' Application. The directory '/CRM/App_Code/' is not allowed because the application is precompiled. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The directory '/CRM/App_Code/' is not allowed because the application is precompiled. Source Error: An unhandled exception was generated during the

Autopost back in mvc drop down list

♀尐吖头ヾ 提交于 2019-11-30 14:30:56
Requirment: I have a drop down list on my view page, displaying a list of vendors. When a vendor is selected from the dropdown, the page displays the details of selected vendor. By default i need to keep first vendor selected and its details displayed. I could accomplish this by using following code. Problem: Dont know how to accomplish autopostback = true in MVC. I need to display the details of selected vendor on selection of vendor in the dropdown list. I am using ASP.net 4.0, MVC3, Entity Framework 4.0. Here is my code: [AcceptVerbs("POST")] public ActionResult SearchResult(FormCollection

How to generate unordered list dynamically in asp.net?

。_饼干妹妹 提交于 2019-11-30 13:03:39
I want to generate a unordered list which contains tag for showing images in my database, I take a look at bulleted list, but it is not working with image. How can i dynamically generate it from the results in a database, for eg, if i have 6 images in data base then i want the list which generates must look like this. <ul id=""> <li><img src="Resources/img14.jpg" alt="" title=""/></li> <li><img src="Resources/img15.jpg" alt="" title=""/></li> <li><img src="Resources/img17.jpg" alt="" title=""/></li> <li><img src="Resources/img2.jpg" alt="" title=""/></li> <li><img src="Resources/img5.jpg" alt=