asp.net-2.0

How can I prevent applicationSettings in the web.config from being inherited?

无人久伴 提交于 2019-12-11 04:08:28
问题 I have an applicationSettings section in my web.config in my ASP.NET 2.0 web application. This works perfectly for storing values and being able to access them as strongly-typed values. Here is a snippet of my web.config: <configuration> ... <applicationSettings> <MyWebsite.Properties.Settings> <setting name="ExcludedItemNumbers" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>123</string>

ASP.NET - Session Time Out

霸气de小男生 提交于 2019-12-11 02:28:37
问题 In the web.config file for my application, in the <sessionState> section I have set timeout="60" (in minutes), but session state variables in my application seem to be expiring in about 1 minutes. Any idea what could cause this? 回答1: Yes. Session timeouts are also specified and controlled by IIS (although there is overlap ofcourse). In IIS 6.0 you also need to check the following places in IIS manager (properties of Virtual directory): ASP.net tab > Edit configuration > Authentication tab >

ASP.NET how to access User.Identity.IsAuthenticated in Aplication Request module?

风流意气都作罢 提交于 2019-12-11 01:51:31
问题 I am using Form Authentication Method in ASP.Net and the problem is it only protect " .aspx" files. I am trying to protect " .php" files in "kcfinder" folder from unauthenticated users. I implemeted this class in "App_Code" folder. public class KCChecker { public static void Process(HttpApplication Application) { HttpRequest Request = Application.Context.Request; HttpResponse Response = Application.Context.Response; string url = Request.Path.ToLower(); if (url.IndexOf("/kcfinder/") == 0 &&

JavaScript Event Handler in ASP.NET

风格不统一 提交于 2019-12-10 22:07:19
问题 I have the following iframe control (intended to be a facebook like button): <iframe id="likeButton" src="http://www.facebook.com/plugins/like.php?href=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" onprerender="setupLink()" </iframe> I have the javascript function defined above this as follows: <script type="text/javascript"> function setupLink() { var iframe = $("#likeButton"); var newSrc = iframe.attr("src"); newSrc += encodeURIComponent

Global.asax Event: Application_OnPostAuthenticateRequest

╄→尐↘猪︶ㄣ 提交于 2019-12-10 21:24:04
问题 I am using Application_OnPostAuthenticateRequest event in global.asax to get a) Roles and permissions of authenticated user also i have made my custom principal class to get user detail and roles and permission. b) To get some information which remain same for that user. void Application_OnPostAuthenticateRequest(object sender, EventArgs e) { // Get a reference to the current User IPrincipal objIPrincipal = HttpContext.Current.User; // If we are dealing with an authenticated forms

How do I do conditional logic within an ASP.NET DataRepeater control?

旧街凉风 提交于 2019-12-10 19:36:57
问题 I'm binding my DataRepeater control to a table that has many columns. I'd like to only display a subset of those, depending on what is populated. How/where should I do my contitional tests within a dataRepeater? This is the code within my itemtemplate: <% if (0= (DataBinder.Eval(Container.DataItem, "first").ToString().Length)) { i++; } %> The error I get is: CS0103: The name 'Container' does not exist in the current context 回答1: You should be fine with this: <% if (0 == (Eval("first")

Best pratice to send asp.net webform to JQuery Autocomplete

这一生的挚爱 提交于 2019-12-10 18:58:54
问题 What I want to do is retrieve all emails from MS SQL Customer table Email column and populate them in using JQuery autocomplete feature. The current system is using VB.NET 2.0. What I have done is get all emails and put them in DataTable and loop through and put them in the string delimited by ",". Put that string into hidden box. JQuery retrieve value from that hidden box and build an array using "array = emails.split(",");". Here is the code. It works pretty good on development server since

What is the most efficient way to handle en expired session with ASP.NET 2.0

怎甘沉沦 提交于 2019-12-10 10:06:22
问题 On the site we are building. We need to be able to redirect the user to a default page when his session has ended. At first sight we used the Session_End with a Response.Redirect to do this job. Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Response.Redirect("~/global/exit.aspx") End Sub But it generates a crapload of Response is not available in this context errors. Naturally we don't want to spam our servers error logs. What is the most efficient way to handle session ending

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory

会有一股神秘感。 提交于 2019-12-10 02:14:09
问题 can any body suggest me how to remove the app_offline.htm file from application root directory in asp.net web application.when i run the page it doesnt show the design of html source 回答1: Go to Visual Studio 05/08 and open the solution explorer. In the root folder there should be a folder named "App_offline.html". Right click on it and delete it. Re-open Visual Studio and you should be able to browse your page. 回答2: If you cannot find app_ofline.htm file in solution explorer, use windows

JavaScript file not reloading in browser when modified on server

六眼飞鱼酱① 提交于 2019-12-09 12:41:13
问题 So I have this ASP.Net 2.0 website that uses functions contained within a JS file. When a webpage loads the js file loads fine. But when I change something in that file on the server the changes are not propagated to user's browser. It keeps working according to the out dated file. How can I force the browser to reload the modified file from the server? 回答1: One rather common solution (that is also used here at SO I think) is to add a query string to the url of the javascript file, containing