我在SharePoint 2013上托管了一个登录页面。在登录按钮上,IE中不显示background-image。图像来自webresource.axd。虽然它在FireFox和Chrome浏览器中运行良好。我使用fiddler来查看webresource是否正确加载。我没有发现任何错误。但是无法看到图像。其余的东西在IE中运行良好,除了来自webresource.axd的图像丢失。 下面是登录页面按钮的C#代码。
objHTMLTableRow = new HtmlTableRow();
// First Cell of Fourth Row
//objHTMLTableCell = new HtmlTableCell();
//objHTMLTableCell.InnerHtml = " ";
//objHTMLTableRow.Cells.Add(objHTMLTableCell); // Add Cell to Row
//Second Cell of Fourth Row
objHTMLTableCell = new HtmlTableCell();
objHTMLTableCell.Attributes.Add("colspan", "2");
objHTMLTableCell.Attributes["style"] = "vertical-align:middle;text-align:center;padding-left:24px;background-image:url(" + Page.ClientScript.GetWebResourceUrl(typeof(com.mitchell.mic.webparts.LoginWebPart), @"com.mitchell.mic.webparts.Images.btn_bg_green.gif") + ");background-repeat:no-repeat;background-position:64px;";
m_objLbtnLogin = new LinkButton();
m_objLbtnLogin.ID = "LBtnLogin";
m_objLbtnLogin.Text = m_sLoginButtonText;
m_objLblBtnGreen = new Label();
m_objLblBtnGreen.Controls.Add(m_objLbtnLogin);
m_objLblBtnGreen.CssClass = "wpBtnRollOver";
objHTMLTableCell.Controls.Add(m_objLblBtnGreen);
m_objLbtnLogin.Click += new EventHandler(m_objLbtnLogin_Click);
objHTMLTableRow.Cells.Add(objHTMLTableCell); // Add second cell to Fourth Row
m_objHTMLTableLogin.Rows.Add(objHTMLTableRow); // Add Fourth Row to Table
以下是已编译的HTML,源自源代码。
<table border="0" cellpadding="0" cellspacing="0" width="198" height="150" style="overflow:hidden;">
<tr>
<td class="wploginbox"><div onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_LBtnLogin')" style="border:0px solid #FFFFFF;padding:0;margin:0;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="wploginform">
<tr>
<td><span>Org ID:</span></td>
<td style="padding-left:4px;"><input name="ctl00$SPWebPartManager1$g_ff042241_1704_4e2b_97e4_a563d8044034$txtOrgID" type="text" value="40011" maxlength="20" id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_txtOrgID" class="wplogininputwhite" style="width:95px;" /></td>
</tr>
<tr>
<td><span>User ID:</span></td>
<td style="padding-left:4px;"><input name="ctl00$SPWebPartManager1$g_ff042241_1704_4e2b_97e4_a563d8044034$txtUserID" type="text" value="20090416" maxlength="20" id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_txtUserID" class="wplogininputwhite" style="width:95px;" /></td>
</tr>
<tr>
<td><span>Password:</span></td>
<td style="padding-left:4px;"><input name="ctl00$SPWebPartManager1$g_ff042241_1704_4e2b_97e4_a563d8044034$txtPassword" type="password" maxlength="10" id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_txtPassword" class="wplogininputwhite" style="width:95px;" /></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;vertical-align:middle;"><span class="wploginform_rememberme"><input id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_ctl19" type="checkbox" name="ctl00$SPWebPartManager1$g_ff042241_1704_4e2b_97e4_a563d8044034$ctl19" checked="checked" /></span><span> Remember Me</span></td>
</tr>
<tr>
<td colspan="2" style="vertical-align:middle;text-align:center;padding-left:24px;background-image:url(/WebResource.axd?d=1RWHPAa3ATF4KY1H2DsfVI9zh7Bz9zyKV8YdpN-1UICCB0xbTxdefmWDROMREcZxTfk5zDruVVFp65oG13wHySv23q8xj6Li_vnUTvDX5yJ7gx3__LeWEaTh-lPDWxUD1PZJ1-E5DTuqr1mkM3B3aRyeYYDAuLCWgH9o5uYSSbyU_YfkP-H0s9ZyCx8yy4Y5n5TTkA2&t=635752756671952932);background-repeat:no-repeat;background-position:64px;"><span class="wpBtnRollOver"><a id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_LBtnLogin" href="javascript:__doPostBack('ctl00$SPWebPartManager1$g_ff042241_1704_4e2b_97e4_a563d8044034$LBtnLogin','')">Login</a></span></td>
</tr>
<tr>
<td style="text-align:center;color:#035388;" colspan="2"><a id="ctl00_SPWebPartManager1_g_ff042241_1704_4e2b_97e4_a563d8044034_hypForgotPwd" href="http://www.qa.mymitchell.com/PasswordMgmt/ForgottenPassword.aspx?co=&userid=&popup=true" target="_blank">Forgot your password?</a></td>
</tr>
</table>
</div></td>
</tr>
</table>