asp.net-4.0

Download Multiple Files Without Using Zip File

放肆的年华 提交于 2019-11-26 15:56:12
问题 I have a generic handler Document.ashx that creates Word documents on the fly by reading information from the querystring like this Document.ashx?clientid=123&documentid=10 and it works perfectly. I need to create an interface with a list of checkboxes and a Download All button. The best idea I've had so far is to use something like this to make the calls to the handler. $("body").append("<iframe src='Document.ashx?clientid=123&documentid=10'></iframe> <iframe src='Document.ashx?clientid=123

How should I perform a long-running task in ASP.NET 4?

允我心安 提交于 2019-11-26 14:43:30
I am building a website using .NET 4. There are lots of MSDN articles dating from 2003, about using Thread objects and 2007, using Asynchronous Pages in .NET 2 , but that is all pretty stale. I know .NET 4 brought us the Task class and some people vaguely cautioning against its use for this purpose . So I ask you, what is the "preferred" method circa 2011 for running background/asynchronous work under IIS in ASP.NET 4? What caveats are there about using Thread/Task directly? Is Async=true still in vogue? EDIT: Ok, ok, from the answers it's clear the opinion is that I should make a service if I

ASP.net Getting the error “Access to the path is denied.” while trying to upload files to my Windows Server 2008 R2 Web server

巧了我就是萌 提交于 2019-11-26 12:22:39
问题 I have an asp.net webapplication that uploads files to a specific folder on the Web server. locally everything works fine, but when I deploy the application to the Webserver, I begin getting the error \"Access to the path \"D:\\Attachments\\myfile.doc\" is denied\". I gave the \"IIS AppPool\" user that the application is running under full permission on the folder. I even gave \"Everyone\" full permissions, but with the same error. I added the folder to the Exceptions list of the Antivirus,

how to remove &#39;name&#39; attribute from server controls?

风格不统一 提交于 2019-11-26 09:57:04
问题 The following asp.net side code of control: <asp:TextBox runat=\"server\" ID=\"LimitTextBox\" Text=\"20\" ClientIDMode=\"Static\" /> Generates such HTML-code: <input name=\"ctl11$ctl00$ctl02$TeamPlayerSelector$LimitTextBox\" type=\"text\" value=\"20\" id=\"LimitTextBox\"> ID attribute - as is required, but how can I remove \'name\' attribute? It is not required for me and is also too long to transfer it to user browser. How can I prevent \'name\' attribute generation? Thanks P.S. I work under

Store String Array In appSettings?

喜夏-厌秋 提交于 2019-11-26 09:47:41
问题 I\'d like to store a one dimensional string array as an entry in my appSettings . I can\'t simply separate elements with , or | because the elements themselves could contain those characters. I was thinking of storing the array as JSON then deserializing it using the JavaScriptSerializer . Is there a \"right\" / better way to do this? (My JSON idea feels kinda hacky) 回答1: You could use the AppSettings with a System.Collections.Specialized.StringCollection. var myStringCollection = Properties

How to fix: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

拟墨画扇 提交于 2019-11-26 09:05:05
问题 I am configuring an MVC 3 project to work on a local install of IIS and came across the following 500 error: Handler \"PageHandlerFactory-Integrated\" has a bad module \"ManagedPipelineHandler\" in its module list. It turns out that this is because ASP.Net was not completely installed with IIS even though I checked that box in the \"Add Feature\" dialog. To fix this, I simply ran the following command at the command prompt %windir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_regiis.exe -i

An attempt to attach an auto-named database for file …database1.mdf failed

夙愿已清 提交于 2019-11-26 08:52:55
问题 I am getting the following error while debugging my visual studio 2010 website: An attempt to attach an auto-named database for file C:\\Users...\\Desktop\\Dpp2012New\\App_Data\\dppdatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. 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

ValidateRequest=“false” doesn&#39;t work in Asp.Net 4

我怕爱的太早我们不能终老 提交于 2019-11-26 06:39:41
I have a form at which I use ckeditor. This form worked fine at Asp.Net 2.0 and 3.5 but now it doesn't work in Asp.Net 4+. I have ValidateRequest="false" directive. Any suggestions? Found solution at the error page. Just needed to add requestValidationMode="2.0" <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime requestValidationMode="2.0" /> </system.web> MSDN information: HttpRuntimeSection.RequestValidationMode Property Ben Hoffman There is a way to turn the validation back to 2.0 for one page. Just add the below code to your web.config: <configuration> <location

How should I perform a long-running task in ASP.NET 4?

冷暖自知 提交于 2019-11-26 05:54:49
问题 I am building a website using .NET 4. There are lots of MSDN articles dating from 2003, about using Thread objects and 2007, using Asynchronous Pages in .NET 2, but that is all pretty stale. I know .NET 4 brought us the Task class and some people vaguely cautioning against its use for this purpose. So I ask you, what is the \"preferred\" method circa 2011 for running background/asynchronous work under IIS in ASP.NET 4? What caveats are there about using Thread/Task directly? Is Async=true

The type is defined in an assembly that is not referenced, how to find the cause?

三世轮回 提交于 2019-11-26 04:58:44
I know the error message is common and there are plenty of questions on SO about this error, but no solutions have helped me so far, so I decided to ask the question. Difference to most of similar questions is me using App_Code directory. Error message: CS0012: The type 'Project.Rights.OperationsProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'Project.Rights, version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Source File: c:\inetpub\wwwroot\Test\Website\App_Code\Company\Project\BusinessLogic\Manager.cs Following suggestions here and here ,