Developers Archive for the 'dot net c# development' Category

Downloading Script - To Not to Disclose the Original URL

Downloading Script - To Not to Disclose the Original URL Friday, March 14th, 2008

Downloading Script

Downloading can be done using the urls where the file is present. The Downloading of the file may disclose the actual url to the users.Hacker may get advantage of it and then can browse through that url and can download the files.

so to not to disclose the following script will be used to hide the url.

string filepath = Server.MapPath(”../directoryname/” + filename);
FileInfo file = new FileInfo(filepath);
if (file.Exists)
{
Response.ClearContent();
Response.AddHeader(”Content-Disposition”, “attachment; filename=” + file.Name);
Response.AddHeader(”Content-Length”, file.Length.ToString());
Response.ContentType = “application/pdf”;
Response.WriteFile(file.FullName);
Response.End();
}

Happy Programming

How to swap the image on hover to get a rollover effect using CSS?

How to swap the image on hover to get a rollover effect using CSS? Thursday, March 13th, 2008

Q.s

How to swap the image on hover to get a rollover effect using CSS?

Ans

Add the Below code in your CSS.

*{
margin:0;
padding:0;
}
ul{
list-style-type:none; /*remove bullets*/
}
li{
display:inline; /*fix IE whitespace in lists bug*/
}
li a:link, li a:visited{
display:block; /*allows anchor to take width and height*/
width:auto; /*equal to image width*/
height:auto;/*equal to image height*/
background:url(”../images/p1_m1.jpg “) 0 0 no-repeat; /*the image*/
text-indent:-2000px; /*moves text out of the way*/
overflow:hidden;
text-decoration:none;
}
li a:link:hover, li a:visited:hover{
background:url(”../images/p2_m1.jpg”) 0 0 no-repeat; /*you can also swap the image on hover to get a rollover effect if desired*/
}

and Add the below tags in your aspx Page

Please note in CSS ../images/p1_m1.jpg,../images/p2_m1.jpg.

../images/p1_m1.jpg - which one you want in First time.

../images/p2_m1.jpg - when you mouseover it swaps the image.

How does Asp.Net Ajax Update Panels work

How does Asp.Net Ajax Update Panels work Wednesday, March 12th, 2008

UpdatePanels have two ways of updating their contents: Always and Conditional. This can be set through the UpdateMode property of each UpdatePanel. The default value is Always which means that the UpdatePanel will refresh on each and every postback, regardless of what control it originated from.

The Conditional mode is much better. When set, the UpdatePanel refreshes only if one of the following conditions are met:

  • A control inside the UpdatePanel (i.e. a child control) invokes a postback.
  • A registered trigger is invoked (such as a button click outside the UpdatePanel).
  • the Update() method for the UpdatePanel is called (through the server side code).

All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.