Êä³öPDFÎĵµµ½ASP.NETÒ³Ãæ
protected
void Page_Load(object sender, EventArgs e)
{
try
{
//query the pdf path
string pdfna =
this.Request.QueryString["pdf"];
if (pdfna == null)
throw new Exception("This
page can not be accessed directly");
string pdf = "Reports\\" +
pdfna;
pdf = Server.MapPath(pdf);
//read all bytes
if (File.Exists(pdf) == false)
throw new Exception("This
report is not created");
FileStream fs = File.Open(pdf,
FileMode.Open);
byte[] buffer = new
byte[fs.Length];
fs.Read(buffer, 0,
buffer.Length);
fs.Close();
//write to response
Response.ContentType =
"application/pdf";
Response.AddHeader(
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
Ò».ºǫ́µ÷ÓÃǰ̨
1.Page.ClientScript.RegisterStartupScript(type,"",script);
Àý:
string script = string.Format("<script>alert('Wrong');</script>");
Page.ClientScript.RegisterStartupScript(GetType(), "Load", script);
2.¶ÔÏó.Attributes.Add("ʼþ","script")
Àý:
e.Row.Attributes.Add("on ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;//CryptographyÃÜÂëÊõ
namespace DAL
{
public class Enc ......
using System.Web;
/// <summary>
/// Javascript³£Ó÷½·¨
/// </summary>
public class JS
{
private static string ScriptStart = "<script type=\"text/javascript\">";
private static string ScriptEnd = "</script>";
&n ......
ASP.NET 4°üÀ¨ÁËһϵÁÐеÄÔËÐÐʱÌØÐÔ£¬¿ÉÒÔ°ïÖúÄã½øÒ»²½ÓÅ»¯ÄãµÄÍøÕ¾¡£ÆäÖÐһЩÐÂÌØÐÔ¿ÉÒÔÓÃÀ´½øÐÐSEOÓÅ»¯ÒÔÌá¸ßÍøÕ¾ÔÚËÑË÷ÒýÇæÖеÄÅÅÃûºÍȨÖØ£¬ÕâЩÌØÐÔ°üÀ¨£º
еÄPage.MetaKeywords ºÍ Page.MetaDescription ÊôÐÔ
Õë¶ÔASP.NET Web FormsµÄÐÂURLµ¼ÏòÖ§³Ö
еÄResponse.RedirectPermanent()·½·¨
ÏÂÃæÊÇÈçºÎÀûÓÃÕâÐ ......