By default, Asp.Net specifies a limit for the input stream buffering threshold. This limit can be used to prevent denial of service attacks that are caused, for example by users posting large files to the server. The default value for this is 4096 kb. If the threshold is exceeded, you get a ConfigurationErrorsExeption with a [...]
Escaping XML text basically means we are trying to replace the “<”, “>” etc. characters that are used to construct the XML with the encoded values. Here are the 5 values that we care about
XML Value
Encoded Value
<
<
>
>
“
"
‘
'
&
&
There are several ways in which you can escape an XML file or string in .Net.
1. Using Regular [...]
21Apr
Posted by admin as .Net, Asp.Net, IIS7, Microsoft, Visual Studio, Web
It is very simple to get the name of the application pool current worker process is associated with in Asp.NET. You can simple use the server variables for that. For example, to display the app pool name on your web page you can simply use the below code snippet.
<%= Request.ServerVariables("APP_POOL_ID") %>
This is usually helpful when [...]
18Dec
Posted by admin as .Net, Asp.Net, Technology, Visual Studio, Web
On some occasions you might want to deploy the Asp.Net MVC application to avoid compiling it yourself etc. You can achieve this by following the below steps
Create an ASP.NET website project in Visual Studio
Add a reference to the System.Web.Mvc.dll (and any other DLLs that your application might need)
Copy the web.config from regular ASP.NET MVC project [...]
On some occasions you might want to use retail versions of Asp.Net JavaScript libraries while debugging your code. (For starters, when in debug mode in Visual Studio, you are not using the release versions, instead you are using debug versions of the libraries). To achieve this all you have do is set the ScriptMode property [...]
17Sep
Posted by admin as .Net, Asp.Net, Microsoft, Technology, Web
On some occasions you would want to run some code for every change in the configuration file, like reload the cache etc.. A change in web.config prompts the app domain to reload. So one should be able to look for application domain shutdown reason to verify a configuration change. Here is how you do can [...]
15Sep
Posted by admin as .Net, Asp.Net, HTML, Microsoft, Technology, Web
On some occasions, you wish to initialize your Asp.net application even before it receives its first hit to get rid of any over heads like creating application domain, initializing the .net runtime environment etc.. To achieve this you can use aspnet_compiler to pre-compile ‘in-place’, so that in effect the application is primed. Compiling ‘in-place’ the [...]
15Sep
Posted by admin as .Net, Asp.Net, Microsoft, Technology, Web
For the starters, Adaptive control behavior is control behavior that is customized for target devices. ASP.NET provides an adaptive architecture that allows key life cycle stages of a control to be intercepted and substituted with custom behavior. A common example of adaptive control behavior is adaptive rendering where an ASP.NET Web page is rendered specific [...]
In a code behind file (like .cs file), one can use aliases for the namespaces like
using myAlias = System.MyNamespace;
But to achieve the same functionality in an .aspx page you can use something like this
<%@ Import Namespace="myAlias=System.MyNamespace" %>
Note: There should not be any spaces in the namespace value. For example you cannot use something like Namespce=”myalias [...]
02Jun
Posted by admin as .Net, Asp.Net, Microsoft, Technology, Visual Studio, Web
You can determine the Name or ID of hosting IIS application from with in the ASP.Net web site or Web application by using “HostingEnvironment” class.
HostingEnvironment class is defined in the System.Web.Hosting namespace.
He is how you get the name of the application and its physical path.
HostingEnvironment.SiteName
HostingEnvironment.ApplicationPhysicalPath
And to get the unique identifier for the Web application,
HostingEnvironment.ApplicationID