asp.net-4.0

asp.net 4.0 webforms - how to keep ContentPlaceHolder1_ out of client id's in a simple way?

落爺英雄遲暮 提交于 2020-03-20 18:34:31
问题 I'm attempting to introduce master pages to an existing webforms site that's avoided using them because of client id mangling in the past (and me not wanting to deal with the mangling and doing <% foo.ClientID %> everywhere :) GOAL: use 'static' id values (whatever is in the server control's id attribute) except for data-bound / repeating controls which would break for those cases and therefore need suffixes or whatever to differentiate (basically, Predictable) Now that the site migrated to

Csla4 and Net4 - ASPNET permission denied on the client

不问归期 提交于 2020-01-25 09:52:04
问题 My application works beautifully when the Net version was not Net4. It continues to work perfectly if I create a new Windows 7 based server from scratch. Configure the permissions and away you go. But (and there is always a but...), my customer has an existing server where the application does not even start when I move to Csla4 and Net4. All the permissions seem to be identical on my "clean" server and on his "legacy but upgraded" server. But the client gets a security error: System.Security

ASP.NET 4 URL limitations: why URL cannot contain any %3f characters

好久不见. 提交于 2020-01-19 05:04:35
问题 http://site.com/page%3fcharacter This URL will return the following error: Illegal characters in path. I'm already put this in web.config: <system.web> <httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" /> <pages validateRequest="false"> ... How can I fix this error? 回答1: If you want to allow the request through, you need to add requestPathInvalidCharacters and set it to an empty string: <system.web> <httpRuntime requestPathInvalidCharacters="" /> </system.web> Edit You

Interop.Word Documents.Open is null

穿精又带淫゛_ 提交于 2020-01-18 15:46:50
问题 I am trying to open .docx file and convert to PDF using Interop.Word.Application. It works as console application but If I use the same in my web application it doesn't work. I tried to see the permissions on the folder. I gave 'Network Service' with full control, but still I get object reference not set at word.Documents.Open. Could you please let me know what could be the problem? I am stuck with this error. Please let me know. I appreciate any suggestions. Thank you. Microsoft.Office

Interop.Word Documents.Open is null

懵懂的女人 提交于 2020-01-18 15:44:13
问题 I am trying to open .docx file and convert to PDF using Interop.Word.Application. It works as console application but If I use the same in my web application it doesn't work. I tried to see the permissions on the folder. I gave 'Network Service' with full control, but still I get object reference not set at word.Documents.Open. Could you please let me know what could be the problem? I am stuck with this error. Please let me know. I appreciate any suggestions. Thank you. Microsoft.Office

Cannot create a TypeConverter for a generic type

馋奶兔 提交于 2020-01-12 06:55:31
问题 I'd like to create a TypeConverter for a generic class, like this: [TypeConverter(typeof(WrapperConverter<T>))] public class Wrapper<T> { public T Value { // get & set } // other methods } public class WrapperConverter<T> : TypeConverter<T> { // only support To and From strings public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } public override bool

ASP.NET Forms Authentication

吃可爱长大的小学妹 提交于 2020-01-11 04:13:06
问题 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

Custom ASPNetMembership FailureInformation always null, OnValidatingPassword issue

依然范特西╮ 提交于 2020-01-07 04:09:16
问题 As stated here http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.onvalidatingpassword.aspx "When the ValidatingPassword event has completed, the properties of the ValidatePasswordEventArgs object supplied as the e parameter can be examined to determine whether the current action should be canceled and if a particular Exception, stored in the FailureInformation property, should be thrown." Here is some details/code which really shows why FailureInformation could be

How do I run a command line process from a web application?

好久不见. 提交于 2020-01-06 13:12:55
问题 I want to run a command line in ASP.NET 4.0 using C#. Actually I need to create a Web Service for doing this. How can I do that? I've read somewhere that when we run command line from Web, there can be some permission issues. If so, how can I overcome that? 回答1: using(var cmd= new Process()) { cmd.StartInfo.FileName = "cmd.exe"; cmd.StartInfo.Arguments = ""; cmd.Start(); } The process is started with the same credentials the web service process is running with. The default is LocalSystem or

altering QueryString parameters / values

寵の児 提交于 2020-01-06 08:11:38
问题 I would like to better understand the issue of setting new parameters to a url and retrieve it via var ParaValue = Request.QueryString["parameterName"]; so if I have a URL : "http://www.myWebsite.aspx?UserName=Alice" I will retrieve it via example above string uName = Request.QueryString["UserName"].ToString(); but what if I want to alter value e.g. make UserName = "Ralf" Re Edit when a button is pressed , there is a parameter "state" that holds a reference to wich button was pressed the