Archive for March 19th, 2008

How to get URL without querystring?

Wednesday, March 19th, 2008

To get the URL information without using querystring using uri class.

tring stringUri = “http://www.tryangled.com/?id=1&auid=16″;
Uri weburi = new Uri(stringUri);
string query = weburi.Query;
string weburl = stringUri.Substring(0, stringUri.Length - query.Length);
Response.Write (weburl);

Posted by Mahesh ( Tryangled )

How to convert the datetime into a string for use in the SQL ‘ statement?

Wednesday, March 19th, 2008

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!Page.IsPostBack )
{
foreach(CultureInfo cInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
ddlCulture.Items.Add(cInfo.Name);
}
}
}

private void ddlCulture_SelectedIndexChanged(object sender, System.EventArgs e)
{
// Get a CultureInfo object based on culture selection in dropdownlist
CultureInfo cInfo = new CultureInfo(ddlCulture.SelectedItem.Text);
// Get a CultureInfo object based on Invariant culture
CultureInfo cInfoNeutral = new CultureInfo(”");
// Display the datetime based on the formatting of the selected culture
TextBox1.Text = Convert.ToString(DateTime.Now , cInfo.DateTimeFormat);
// Create a DateTime variable to hold the Invariant time
DateTime dt ;
dt = Convert.ToDateTime(TextBox1.Text, cInfo.DateTimeFormat);
//Convert the datetime into a string for use in the SQL statement
Label1.Text = “… WHERE ([Date] < ‘” + Convert.ToString(dt, cInfoNeutral.DateTimeFormat) + “‘)”;
}

Posted by Mahesh ( Tryangled )

How do I publish my ASP.NET application to ISP’s web server?

Wednesday, March 19th, 2008

Your ISP must first create an IIS application and apply the Front Page Server Extensions to it. Then in Visual Studio .NET, select the “Project | Copy Project” menu. Then enter the URL and select the FrontPage web access method. The “Copy Project” feature copies all of the necessary files to your ISP’s machine for your ASP.NET application to run.
You can also FTP your files to your ISP web server. But you must know which files to upload.

Posted by Mahesh ( Tryangled )