AFAIK, there
.Net control Codes
Convert the Request URL to an SSL/HTTPS link
December 28th, 2009
Ankit For example to take the current request URL and converted it to a secure URL can be done like this:
Secure Sockets Layer (SSL).
UriBuilder build = new UriBuilder(Request.Url); build.Scheme = "https"; build.Port = -1; // don't inject port Uri newUri = build.Uri; string newUrl = build.ToString();
Request Object of ASP .NET related to Paths
December 28th, 2009
Ankit Request Object
Here’s a list of the Path related properties on the Request object (and the Page object). Assume a path like http://www.avmendapara.com/wallpaper/admin/paths.aspx for the paths below where webstore is the name of the virtual.
here property of request object given
ApplicationPath :
Returns the web root-relative logical path to the virtual root of this app. /wallpaper/
PhysicalApplicationPath :
Returns local file system path of the virtual root for this app.
c:\inetpub\wwwroot\wallpaper
PhysicalPath
Returns the local file system path to the current script or path.
c:\inetpub\wwwroot\wallpaper\admin\paths.aspx
CurrentExecutionFilePath FilePath Path
All of these return the full root relative logical path to the script page including path and scriptname. /wallpaper/admin/paths.aspx
AppRelativeCurrentExecutionFilePath
Returns an ASP.NET root relative virtual path to the script or path
~/admin/paths.aspx
PathInfo
Returns any extra path following the script name. If no extra path is provided returns the root-relative path (returns text in red below). string.Empty if no PathInfo is available.
/wallpaper/admin/paths.aspx/ExtraPathInfo
RawUrl
Returns the full root relative relative URL including querystring and extra path as a string. /wallpaper/admin/paths.aspx?sku=wwhelp40
Url
Returns a fully qualified URL including querystring and extra path. Note this is a Uri instance rather than string. http://www.avmendapara.com/wallpaper/admin/paths.aspx?sku=wwhelp40
UrlReferrer
The fully qualified URL of the page that sent the request. This is also a Uri instance and this value is null if the page was directly accessed by typing into the address bar or using an HttpClient. Based Referrer client Http header. http://www.avmendapara.com/wallpaper/default.aspx?Info
Control.TemplateSourceDirectory
Returns the logical path to the folder of the page, master or user control on which it is called. This is useful if you need to know the path only to a Page or control from within the control. For non-file controls this returns the Page path. /wallpaper/admin/
As you can see there
Download Data Services Update for .NET 3.5 SP1
December 17th, 2009
Ankit Data Services Update for .NET 3.5
We
Rename your all files located in one folder
November 5th, 2009
Ankit rename files just use this code its rename all files which is located in your folder path
string dest;
string[] a = new string[5];
string b = Server.MapPath(”your folder path”);
a = Directory.GetFiles(b);
for (int i = 0; i < a.Length; i++)
{
FileInfo sos = new FileInfo(a[i].ToString());
//string c = a[i].ToString();
//source = a[i].ToString();
dest = b + “your new path”;
sos.MoveTo(dest);
}
Renaming In .net With C#
November 5th, 2009
Ankit Renaming Your files using c# just copy and paste your code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace rhozetApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int File_Delete(string Filepath)
{
FileInfo fi = new FileInfo(Filepath);
if (fi.Exists)
{
fi.Delete();
}
return 1;
}
private int File_rename(string FilepathOld, string FilepathNew)
{
FileInfo fi = new FileInfo(FilepathOld);
if (fi.Exists)
{
fi.MoveTo(FilepathNew);
}
return 1;
}
private void button1_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(”C:\\dateiname.txt”);
if (fi.Exists)
{
fi.MoveTo(”C:\\dateiname.mpg”);
textBox1.Text = ” Succesfull! “;
}
else
{
textBox1.Text = ” Failed! “;
}
}
}}
in c# rename your files by coding just use this code
Ajax CollapsiblePanelExtender in .net
October 28th, 2009
Ankit Ajax CollapsiblePanelExtender in Asp.Net:
There are the following easy steps to understand how to use Ajax CollapsiblePanelExtender control in Asp.Net.
Step 1: Create new Ajax enabled website
Step 2: Now go to solution explorer and right click on root directory and click on Add reference then add AjaxControlTollkit.dll.
Step 3: Copy the following code and paste on to your page.
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<%@ Register Assembly=”AjaxControlToolkit” Namespace=”AjaxControlToolkit” TagPrefix=”ajaxToolkit” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head id=”Head1″ runat=”server”>
<title>CollapsiblePanel</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<asp:ScriptManager runat=”server” ID=”scriptManager1″ />
<div style=”width: 410px; background: gray;”>
<asp:Panel runat=”server” ID=”panel1″>
<div style=”font-weight: bold; background-color: ThreeDShadow;”>
<table width=”100%”>
<tr>
<td align=”left”>Clicking Here To view my profile
<asp:Label runat=”server” ID=”textLabel” />
</td>
<td align=”right” width=”10px”>
<asp:Image ID=”Image1″ runat=”server” />
</td>
</tr>
</table>
</div>
</asp:Panel>
<asp:Panel runat=”server” ID=”panel2″ Width=”98%” HorizontalAlign=”center”>
<div>
<table width=”100%”>
<tr valign=”top”>
<td align=”left” width=”100px”>
<img src=”myPhoto.jpg” />
</td>
<td align=”left”>Hi<br />This is Ankit Mendapara<br />09429097567<br />India
</td>
</tr>
</table>
</div>
</asp:Panel>
<ajaxToolkit:CollapsiblePanelExtender runat=”server” ID=”cpe” TargetControlID=”panel2″ CollapseControlID=”panel1″ ExpandControlID=”panel1″ Collapsed=”true” CollapsedSize=”0″ ExpandedSize=”120″ ExpandedText=”(Collapse…)” CollapsedText=”(Expand…)” TextLabelID=”textLabel” ImageControlID=”Image1″ ExpandedImage=”Img/collapse.jpg” CollapsedImage=”Img/expand.jpg”>
</ajaxToolkit:CollapsiblePanelExtender>
</div>
</form>
</body>
</html>
Step4: Now Debug the application by press F5,
File Upload Control
October 21st, 2009
Ankit //fileupload.aspx.cs file
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class fileupload : System.Web.UI.Page
{
string destpath;
public string filename;
public static string[] name = new string[20];
public static int i = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
i = 0;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
if (FileUpload1.PostedFile.ContentLength > 100000)
{
lblmsg.Text = “too largr. file upload not allow”;
}
else
{
string desdir = Server.MapPath(”upload”);
filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
//string destpath = Path.Combine(despath,”a.txt”);
destpath = Path.Combine(desdir, filename);
FileUpload1.PostedFile.SaveAs(destpath);
lblmsg.Text = “file uploaded” + “
” + “file name:” + filename + “
” + “filesize:” + FileUpload1.PostedFile.ContentLength + “
” + “application type:” + FileUpload1.PostedFile.ContentType;
// Image1.ImageUrl = “~/upload/” + filename;
gentable();
}
}
else
{
lblmsg.Text = “please select file for upload”;
}
}
public void gentable()
{
name[i++] = filename;
Table t = new Table();
t.BorderWidth = 5;
t.BorderColor = System.Drawing.Color.Black;
Page.Controls.Add(t);
for (int j = 0; j < i; j++)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TableCell tc1 = new TableCell();
tc.Text = name[j];
tc.BorderWidth = 5;
tc.BorderColor = System.Drawing.Color.Lavender;
tc1.Text = Convert.ToString(DateTime.Now);
tc1.BorderWidth = 5;
tc1.BorderColor = System.Drawing.Color.Lavender;
tr.Cells.Add(tc);
tr.Cells.Add(tc1);
t.Rows.Add(tr);
}
}
}








































Posted in
Tags:



