asp.net-4.0

Asp.net 4.0 : How to get exception details in custom error page?

痴心易碎 提交于 2019-12-22 05:05:00
问题 We are using custom error provided by asp.net config setting. In entire application (PL/BLL/DAL) we are not using any try catch. So for any exception in any layer application redirect user to custom error page set in custom error setting in config file. Now we want to log following information in log file before showing error page: - Date & time - Exception message & strack trace. - Page Name - Method Name - Method Parameter & values. Please help me how to collect above information in custom

Launching a long-running background task - from ASP.NET or a scheduled job

大兔子大兔子 提交于 2019-12-21 20:59:40
问题 I have a fairly long-running process (several minutes) that I need to run roughly once a month - but not on a fixed schedule, but after a user clicks Go in a ASP.NET Webforms GUI page. Since ASP.NET really isn't designed to handle long-running background tasks, my idea was to put this into a separate console app. But how to launch that as needed? What happens if I use Process.Start(....) from my ASP.NET page's code-behind? I would like to avoid blocking the whole Web UI for 20 minutes or so..

How to create RouteUrls with databound parameters declaratively?

雨燕双飞 提交于 2019-12-21 17:56:42
问题 I'm using the new Routing feature in ASP.NET 4 (Web forms, not MVC). Now I have an asp:ListView which is bound to a datasource. One of the properties is a ClientID which I want to use to link from the ListView items to another page. In global.asax I have defined a route: System.Web.Routing.RouteTable.Routes.MapPageRoute("ClientRoute", "MyClientPage/{ClientID}", "~/Client.aspx"); so that for instance http://server/MyClientPage/2 is a valid URL if ClientID=2 exists. In the ListView items I have

ASP.NET-4 IIS7.5 web.config serverRuntime element

徘徊边缘 提交于 2019-12-21 05:08:51
问题 Whenever I add this line to my web.config in the system.webServer section: <serverRuntime /> With our without properties, IIS 7.5 just serves up a blank page instead of the website. I created a new empty Web Application using IIS and added the line to the web.config; blank page. What am I doing wrong? 回答1: I had this exact problem and solved it by unlocking the serverRuntime section of the applicationHost config. Command to run at console: %windir%\system32\inetsrv\appcmd unlock config

How to add users in IIS Manager for an ASP.NET 4.0 application?

对着背影说爱祢 提交于 2019-12-20 19:39:14
问题 I have installed an ASP.NET 4.0 Web forms application in IIS 7.5. If I set the application pool to DefaultAppPool (.NET Framework 2.0) I get the icons for Providers, .NET-Roles and .NET-Users displayed on the configuration page for the application in IIS Manager and I can manage users and roles within IIS. (I'm using Forms authentication.) But if I set the application pool to ASP.NET v4.0 I get a problem: Double clicking on the icons for Users or Roles in IIS Manager throws an error telling

web site configuration

梦想与她 提交于 2019-12-20 10:24:34
问题 One web site is required to be accessed by me (developer) and one user (DOMAIN_NAME\USER_NAME). When I developed web site in visual studio using "automatic host" created by VS, the following settings in web.config were enough: <authentication mode="Windows"/> <authorization> <allow users="DOMAIN_NAME\my_name,DOMAIN_NAME\USER_NAME" /> <deny users="*" /> </authorization> But when I created web site in IIS I'm receiving error: Access is denied. Description: An error occurred while accessing the

How to subscribe to click event of html form?

回眸只為那壹抹淺笑 提交于 2019-12-20 06:49:45
问题 I have a google checkout "buy now" button and I want to add dynamically created information to send when it's clicked. How do I do that? The button's html is: <form action="https://sandbox.google.com/checkout/..." id="Form1" method="post" name="..." target="_top"> <input name="item_name_1" type="hidden" value="..." /> ... <input alt="" src="https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=..." type="image" /> </form> So what do I add? (And if possible, I'd like to do that

ASP.NET 4 Parser Error

纵然是瞬间 提交于 2019-12-20 05:38:52
问题 I received a asp.net 2 to upgrade to .net 4. While most of it went well I'm stuck on a line that can't find a solution for it. I get a Parser Error Message: The server tag is not well formed. at this line <li><a class="tooltip viewPolicyLink" rel="<%#Eval("key")%>" title="<%#Eval("value")%>" href="<%#ResolveUrl("~/Views/Pages/ViewPolicy.aspx")%>" runat="server"><%#Eval("key")%></a></li> What's wrong with it? 回答1: you have messed with " try : <li><a class='tooltip viewPolicyLink' rel='<%#Eval(

How to specify url mappings in ASP.NET 4.0 when parameters are involved?

冷暖自知 提交于 2019-12-20 04:39:07
问题 The problem I have a web site with some articles inside. Articles are accessed using a database writing results on a single page. When a certain article is to be accessed, I need the article-id and I only need to get to the page: http://www.mysite/Articles.aspx?a={article-id} . This is nice but not really friendly and not scalable. What I want to do is to redirect every url in the form: http://www.mysite/articles/{article-id} to the page http://www.mysite/Articles.aspx?a={article-id} . I know

How to access localised resources in an .ashx file?

大城市里の小女人 提交于 2019-12-20 02:52:48
问题 I have an ashx file which returns a localised message. This is called from an Ajax request. I need to access the Asp.net ResourceManager in the ashx file. 回答1: Following code worked for me. HttpContext.GetGlobalResourceObject("classKey", "resourceKey") as string; 回答2: Any resources in the app should be accessible under the Resources namespace. For a resource file called LocalMessages.en.resx: ReturnMsg = Resources.LocalMessages.MyAjaxMessage; For intellisense to work, make sure app has been