To get the current page URL you could use HttpContext.Current.Request.Url:
1. To get the full URL with query string (if any) you could use:
string absoluteurl = HttpContext.Current.Request.Url.AbsoluteUri;
2. To get the path without the domain you could use:
string absolutepath = HttpContext.Current.Request.Url.AbsolutePath;
3. To get the Host:
string host = HttpContext.Current.Request.Url.Host;
Related TutorialsASP.NET Performance
How to refresh an image in ASP.NET
How to …
Many times, when you create larger ASP.NET site you need to optimize the application and IIS web server, so to improve the user experience. We say that the ASP.NET website is good optimized when server response time is bellow 200 ms (milliseconds).
Speed up ASP.NET web site
You can improve your ASP.NET website performance when:
– Use ASP.NET Caching;
– Use IIS …
You can zip a file or a folder in ASP.NET by using java.util.zip.ZipFile, ICSharpCode.SharpZipLib.Zip or other library assemblies.
SharpZipLib can be downloaded from: https://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx.
The ASP.NET examples below demonstrate how to zip files.
ZipOutputStream zos = null;
protected void Button1_Click(object sender, EventArgs e)
string pathCollection = new string;
PathCellction = “c:\\folder1”;
You can start learning at ASP.NET tutorial. You can learn the basics of .NET first, then to watch some videos, you can also try some quick examples.
To learn more about data-access in .NET you could visit SQL tutorials. This is an important part of learning .NET.
You could also read some of the best programming books at ASP.NET …
If none of the existing ASP.NET server controls meet your requirements, then you can create a custom control by deriving from one of the base control classes. This Web Forms ASP.NET tutorial will show you how to achieve this.
Adding Custom Control to the Toolbox
1. Create a test Web Forms page. (WebForm1)
2. Using Tools menu, click Add/Remove Toolbox Items.
Many developers use ASP.NET with MySQL with their applications. If you use ASP.NET hosting services and some of the .NET stack as VB.NET or C# then you could connect to the MySQL database using ODBC .net data provider. Please follow the next MySQL C# ASP.NET tutorial to achieve your goals.
Connect to MysQL database using C# using ASP.NET hosting
This is a very common scenario when you would like to disable button after click, so the user could not click it again if you need some time to do some task which takes longer time to be executed. The next ASP.NET tutorial will show you how to do it:
Disable a button after click in ASP.NET before the …
When you want to write encoded text on the web page you should use the Literal control, because it does support a property that is not supported by the Label control: the Mode property. The property enables you to encode HTML content and accept any of the following three values:
– PassThrough—Displays the contents of …
The next code shows how you can attach an asp:Label control with the asp:TextBox. In this case when the user clicks the Label the application will focus on the TextBox.
<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TestAssociate.aspx.vb” Inherits=”TextChange.TestAssociate” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<title>Associate a Label with a TextBox</title>
<form id=”form1″ runat=”server”>
You can assign classes to menu options, to create multiple background colors within the drop-down color. In this case you need to set only the color and background-color properties for a menu item. The next two test files show this: