我刚进这个公司,前一个写程序的走了,没有留下开发文档,自己熟悉了几天代码,我从服务器上面把程序把数据库复制到了本地,配置环境 都配置好了 开始的时候验证码能显示,后台登录的验证码一直不能显示,蛋疼了一个星期了,各位帮我参谋参谋。。网上说的办法我都试过了,开启了父路径,开启ADODB.Stream了组件,浏览器没问题,我估计是验证码文件的问题,因为我一直找不到random验证码文件。<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Jetway.Web.Areas.Admin.Models.AdminSignIn>" %>
<%@ Import Namespace="CaptchaExample.Helpers" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>管理员登录</title>
        <link href="<%:Url.Content("~/Content/Css/Validation.css")%>" rel="stylesheet" type="text/css" />
        <style type="text/css">
            html,body
            {
                height:100%;
            }
            body,input
            {
                font-family:微软雅黑;
                font-size:12px;
            }
            .login-table
            {
                background-image:url(../../Content/Images/loginbg.jpg);
                background-position:center center;
                width:554px;
                height:518px;
            }
            .form-table
            {
                width:312px;
                margin-top:88px;
                margin-right:10px;
            }
            .form-table td
            {
                height:36px;
                vertical-align:middle;
            }
            .form-table td input
            {
                width:120px;
            }
            #ValidateCode
            {
                width:42px;
            }
            .tip-td
            {
                text-align:left;
                vertical-align:bottom;
            }
        </style>
        <script src="<%:Url.Content("~/Scripts/jquery-1.4.1.min.js")%>" type="text/javascript"></script>
    </head>
    <body>
        <script type="text/javascript">
            $(function () {
                $("#ValidateCode").focus(function () {
                    $("#captchaImg").attr("src", '<%:Url.Action("Render", "CaptchaImage",new{area=""})%>' + '/' + Math.random()).css({ 'display': 'inline', 'cursor': 'pointer' });
                    $(this).unbind("focus");
                })
                $("#captchaImg").click(function () {
                    $("#captchaImg").attr("src", '<%:Url.Action("Render", "CaptchaImage",new{area=""})%>' + '/' + Math.random());
                });
            });
        </script>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" style="height:100%;">
            <tr>
                <td style="height:100%;" align="center">
                    <table border="0" cellpadding="0" cellspacing="0" class="login-table">
                        <tr>
                            <td align="right" valign="top">
                            <% Html.EnableClientValidation(); %>
                            <%using(Html.BeginForm()){%>
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="width:212px;text-align:left"><%:Html.ValidationSummary(true)%></td>
                                        <td class="tip-td">
                                            <table border="0" cellpadding="0" cellspacing="0" class="form-table">
                                                <tr>
                                                    <td style="width:48px; text-align:right;">
                                                        用户名:
                                                    </td>
                                                    <td style="text-align:left; padding-left:5px;">
                                                        <%:Html.EditorFor(x => x.Administrator.Name)%>
                                                        <%:Html.ValidationMessageFor(x => x.Administrator.Name, "用户名格式有误!")%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:48px; text-align:right;">
                                                        密码:
                                                    </td>
                                                    <td style="text-align:left; padding-left:5px;">
                                                        <%:Html.EditorFor(x => x.Administrator.Password)%>
                                                        <%:Html.ValidationMessageFor(x => x.Administrator.Password, "密码格式有误!")%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:48px; text-align:right;">
                                                        验证码:
                                                    </td>
                                                    <td style="text-align:left; padding-left:5px;">
                                                        <table  border="0" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td>
                                                                    <%:Html.TextBoxFor(x => x.ValidateCode, new {maxlength=6})%>
                                                                </td>
                                                                <td>
                                                                    <img id="captchaImg" alt="点击刷新" title="点击刷新" style=" display:none;"/>
                                                                </td>
                                                                <td>
                                                                    &nbsp;<%:Html.ValidationMessageFor(x => x.ValidateCode)%>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td></td>
                                                    <td style="text-align:left; padding-left:5px;">
                                                        <input type="submit" value="登录" style="width:48px;"/>
                                                        <input type="reset" value="重置" style="width:48px;"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            <%}%>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <script src="<%=Url.Content("~/Scripts/MicrosoftAjax.js")%>" type="text/javascript"></script>
        <script src="<%=Url.Content("~/Scripts/MicrosoftMvcAjax.js")%>" type="text/javascript"></script>
        <script src="<%=Url.Content("~/Scripts/MicrosoftMvcValidation.js")%>" type="text/javascript"></script>
    </body>
</html>

解决方案 »

  1.   

    看看你的代码是否有问题或者你的文件路径<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/ValitionNo.aspx" />
    ValitionNo.aspx是生成验证码文件
      

  2.   

    点击图片右键属性,查看url地址是什么
      

  3.   

    http://127.0.0.1/captcha-image/render/0.0005715132218908625  属性是这个
      

  4.   

    那你就在浏览器地址栏里面输入http://127.0.0.1/captcha-image/render/0.0005715132218908625看显示或者提示什么?
      

  5.   

    郁闷 上传不了图片 打开http://127.0.0.1/captcha-image/render/0.0005715132218908625 显示:
    无法找到该页
    您正在搜索的页面可能已经删除、更名或暂时不可用。 
    --------------------------------------------------------------------------------请尝试以下操作:•确保浏览器的地址栏中显示的网站地址的拼写和格式正确无误。
    •如果通过单击链接而到达了该网页,请与网站管理员联系,通知他们该链接的格式不正确。 
    •单击后退按钮尝试另一个链接。
    HTTP 错误 404 - 文件或目录未找到。
    Internet 信息服务 (IIS)--------------------------------------------------------------------------------技术信息(为技术支持人员提供)•转到 Microsoft 产品支持服务并搜索包括“HTTP”和“404”的标题。
    •打开“IIS 帮助”(可在 IIS 管理器 (inetmgr) 中访问),然后搜索标题为“网站设置”、“常规管理任务”和“关于自定义错误消息”的主题。
    而服务器上面的 访问能看到验证码
      

  6.   

    一般应该是这样写吧
    http://127.0.0.1/captcha-image/render
    带随机数应该
    http://127.0.0.1/captcha-image/render/?0.0005715132218908625
      

  7.   

    程序是从服务器上面拷贝下来的。。数据库什么都是好的 我纳闷公司电脑2003的系统和win7的系统都不能显示,我家里的笔记本winxp也不能显示  就服务器上面能显示
      

  8.   

    打开net_lover说的
    http://127.0.0.1/captcha-image/render/?0.0005715132218908625 显示Server Error in '/' Application.
    --------------------------------------------------------------------------------Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
    [HttpException (0x80072749): Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.]
       System.Web.SessionState.OutOfProcSessionStateStore.MakeRequest(StateProtocolVerb verb, String id, StateProtocolExclusive exclusiveAccess, Int32 extraFlags, Int32 timeout, Int32 lockCookie, Byte[] buf, Int32 cb, Int32 networkTimeout, SessionNDMakeRequestResults& results) +2180324
       System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +221
       System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +807
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 
      

  9.   

    本帖最后由 net_lover 于 2011-12-27 14:10:35 编辑
      

  10.   

    0.0005715132218908625 这个数值是生成的验证码iis里面配置通配符映射 请教下 怎么配置
      

  11.   

    通配符设置方法
    http://www.google.com.hk/search?q=iis%20%E9%80%9A%E9%85%8D%E7%AC%A6%E6%98%A0%E5%B0%84&oe=utf-8&rls=org.mozilla:zh-CN:official&client=firefox-a&um=1&hl=zh-CN&biw=1366&bih=585&ie=UTF-8&sa=N&tab=iw&ei=imT5Tvb9GI2WiQfohLm8AQ
      

  12.   

    另外,错误提示说你的 Session采取的是StateServer方式的,你需要启动 ASP.NET State 服务,并配置连接,开放端口等
      

  13.   

    置通配符映射  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll  直接就打不开网页了 晕
      

  14.   

    http://127.0.0.1/captcha-image/render/ 能显示验证码了 后台不能显示 郁闷
      

  15.   

    http://127.0.0.1/captcha-image/render/ 能显示验证码了 后台不能显示 郁闷