本人在asp.net开发的过程中遇到如下问题,请各位高手指点迷津:
1、 页面设置:页面中有一个文本框,一个标签,一个按钮,以下统称为页面1。
要求:文本框中只能输入半角数字,如果文本框内输入的不是半角数字,则要用标签显示一个错误信息(“请输入半角数字!”),不能用验证控件代替,也不能用一个专门的页面显示错误信息。如果文本框内输入半角数字,单击按钮之后,则跳转到另一个页面。错误再现的操作步骤:在文本框中输入一个字母,然后点击按钮(由于输入的是字母,所以要用标签显示一个错误信息)。把文本框的字母改为一个半角数字,然后点击按钮调到另一个页面,在点击浏览器上的返回按钮,回到页面1。此时,标签上的错误信息(“请输入半角数字!”)仍然存在(我在按钮的click事件里已经给标签赋了空值)。正确的要求是:返回到页面1的时候标签被清空。
请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!
2、 有关文件保存的问题
页面设置:页面中有一个下拉列表框(DropDownList)、一个文本框、一个按钮
下拉列表框的AutoPostBack属性为True。在下拉列表框的selectchanged事件中添加如下代码(textbox.text=dropdownlist.selectvalue),以达到为文本框赋值的目的。用下面的代码实现文件保存的功能:
result = rs.Render(reportPath, format, historyID, devInfo, _
params, credentials, showHideToggle, _
encoding, mimeType, reportHistoryParameters, _
warnings, streamIDs)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(pFileName & "." & pFormat))
HttpContext.Current.Response.AddHeader("Content-Length", result.Length.ToString())
HttpContext.Current.Response.ContentType = "application/" & pFormat
HttpContext.Current.Response.BinaryWrite(result)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.Close()操作:在下拉列表框中选择一个项目之后,会将选中的值赋给文本框。错误再现的操作步骤:
点击按钮之后会弹出一个文件下载对话框,然后点击下载对话框上的保存按钮,弹出一个指定保存路径的对话框,保存文件。回到页面,再次选择下拉列表框之后,却不能给文本框值赋了。我研究的很久,只要弹出了那个指定保存路径的对话框,就会出现这种错误。正确的要求是:弹出了那个指定保存路径的对话框之后也要保证,再次选择下拉列表框之后,也能给文本框值赋。
如果上述问题无法解决的话,能够实现下面的功能也可以:
本人要把报表保存为PDF文件。同样使用上面的那段代码,点击按钮弹出一个文件下载对话框,点击文件下载对话框上的打开按钮,这时会直接打开一个PDF文件显示报表。注意,不是在浏览器中打开PDF文件,而是就像用Adobe Reader阅读器打开一个PDF文件那样。能实现上述功能也可以。请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!3、 有关ReportViewer控件的问题
错误再现的操作步骤:首先把IIS服务目录的报表服务器的允许匿名访问的属性禁掉,然后再生成报表,这个时候就会弹出一个身份验证的对话框,要求输入用户名和密码。要求:仍旧使用ReportViewer控件,还要禁止匿名访问,在这样的前提下,能否在程序中实现身份验证,而不弹出那个身份验证的对话框。
请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!
1、 页面设置:页面中有一个文本框,一个标签,一个按钮,以下统称为页面1。
要求:文本框中只能输入半角数字,如果文本框内输入的不是半角数字,则要用标签显示一个错误信息(“请输入半角数字!”),不能用验证控件代替,也不能用一个专门的页面显示错误信息。如果文本框内输入半角数字,单击按钮之后,则跳转到另一个页面。错误再现的操作步骤:在文本框中输入一个字母,然后点击按钮(由于输入的是字母,所以要用标签显示一个错误信息)。把文本框的字母改为一个半角数字,然后点击按钮调到另一个页面,在点击浏览器上的返回按钮,回到页面1。此时,标签上的错误信息(“请输入半角数字!”)仍然存在(我在按钮的click事件里已经给标签赋了空值)。正确的要求是:返回到页面1的时候标签被清空。
请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!
2、 有关文件保存的问题
页面设置:页面中有一个下拉列表框(DropDownList)、一个文本框、一个按钮
下拉列表框的AutoPostBack属性为True。在下拉列表框的selectchanged事件中添加如下代码(textbox.text=dropdownlist.selectvalue),以达到为文本框赋值的目的。用下面的代码实现文件保存的功能:
result = rs.Render(reportPath, format, historyID, devInfo, _
params, credentials, showHideToggle, _
encoding, mimeType, reportHistoryParameters, _
warnings, streamIDs)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(pFileName & "." & pFormat))
HttpContext.Current.Response.AddHeader("Content-Length", result.Length.ToString())
HttpContext.Current.Response.ContentType = "application/" & pFormat
HttpContext.Current.Response.BinaryWrite(result)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.Close()操作:在下拉列表框中选择一个项目之后,会将选中的值赋给文本框。错误再现的操作步骤:
点击按钮之后会弹出一个文件下载对话框,然后点击下载对话框上的保存按钮,弹出一个指定保存路径的对话框,保存文件。回到页面,再次选择下拉列表框之后,却不能给文本框值赋了。我研究的很久,只要弹出了那个指定保存路径的对话框,就会出现这种错误。正确的要求是:弹出了那个指定保存路径的对话框之后也要保证,再次选择下拉列表框之后,也能给文本框值赋。
如果上述问题无法解决的话,能够实现下面的功能也可以:
本人要把报表保存为PDF文件。同样使用上面的那段代码,点击按钮弹出一个文件下载对话框,点击文件下载对话框上的打开按钮,这时会直接打开一个PDF文件显示报表。注意,不是在浏览器中打开PDF文件,而是就像用Adobe Reader阅读器打开一个PDF文件那样。能实现上述功能也可以。请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!3、 有关ReportViewer控件的问题
错误再现的操作步骤:首先把IIS服务目录的报表服务器的允许匿名访问的属性禁掉,然后再生成报表,这个时候就会弹出一个身份验证的对话框,要求输入用户名和密码。要求:仍旧使用ReportViewer控件,还要禁止匿名访问,在这样的前提下,能否在程序中实现身份验证,而不弹出那个身份验证的对话框。
请各位过路神仙、侠客们为愚兄指点迷津,有现金酬谢!
private void Page_Load(object sender, System.EventArgs e)
{
this.downLoadFile();
}
public void downLoadFile()
{
string strFileName = Request["FileName"];
System.IO.FileInfo aFileInfo =
new System.IO.FileInfo(strFileName);
//检查文件是否存在
if(!aFileInfo.Exists)
throw new Exception(strFileName+" file not exist !");
//设置Response
Response.Buffer = true;
Response.Clear();
//设置头
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlEncode(aFileInfo.Name) );
Response.AddHeader("Content-Length",aFileInfo.Length.ToString());
Response.Charset = "UTF-8";
Response.ContentType = "application/octet-stream";
//输出文件
Response.WriteFile(strFileName);
Response.Flush();
Response.End();
}在下载页面下载按钮上添加Response.Redirect(DownLoad.aspx?FileName="+strFileName+"')即可,这一段也可用JS来实现:window.open('DownLoad.aspx?FileName="+strFileName+"','_blank','width=0,height=0,','')。
If IIS doesn't recognize the domain name sent by the browser, then it will have no idea where to send the information for validation. This is more common for Internet than intranet users, because a person sitting at home is rarely on a domain (and even if they are, their domain controller probably isn't accessible by the IIS machine). Internet Explorer will prompt the user to enter a new name and password, in effect saying, "Give me some information that I can use." If an employee working at home were trying to access a secured site, they would need to enter their name (in the form of BigDomain\JoeUser) and password to enable IIS to get the correct domain information. Explicitly stating the domain name in this manner is almost always necessary to authenticate users across the Internet.
Under Basic authentication, the user will always be prompted with a logon dialog. You can probably guess why. You are about to do something that could compromise your Windows NT account name and password. All browsers figure that if you are willing to fill in the information and press OK, then you must know what you are doing. I personally don't have a problem using Basic authentication on a secure corporate network, but I will not use it over the Internet without an additional layer of security such as Secure Sockets Layer (SSL is invoked on a specially-configured Web server that uses HTTPS:// instead of HTTP://). Once again, the user will need to explicitly state the domain. IIS still needs to verify the submitted information with some domain controller.
----->摘自MSDN,看样楼主的第三问题,难度不小。
然后再send()
这两天老重装系统,都晕了,
对游览器的要求是,ie5.5以上,
ie6不能打了sp1,
如果打了,需要下微软的一个补丁
http://support.microsoft.com/default.aspx?kbid=832414
能否把你们说的那种实现方法写的详细一点,最好能用代码说明
Page.RegisterClientScriptBlock("login","<script>"+script+"</script>");
btnLogin.Attributes["onclick"]="javascript:var user=document.all.tbUserName.value;var pwd=document.all.tbPassword.value;login(user,pwd);";