2013-07-18 3 views
2

글쎄, "This works on my machine"의 경우입니다.ASP.Net LinkButton은 로컬에서는 작동하지만 서버에서는 작동하지 않습니다.

문제는 :

나는에 LinkButton을 내 GridView :

dr["L_Website"] = Convert.ToString(reader["L_Website"]); 

어쩌면 당신은 또한보고 싶어 : 나는 DataReader으로 데이터를 입력

<asp:TemplateField HeaderText="Website"> 
    <ItemTemplate> 
     <asp:LinkButton ID="L_Website" CausesValidation="true" runat="server" Text='<%# Eval("L_Website") %>' 
      CommandArgument="GoToWebsite" OnClientClick="return confirm('Are you sure you want to go to this Website?');" 
      CommandName="GoToWebsite"></asp:LinkButton> 
    </ItemTemplate> 
</asp:TemplateField> 

GoToWebsitecode :

protected void GV_Contacts_RowCommand(object sender, GridViewCommandEventArgs e) 
{ 
    string ID = string.Empty; 
    string status = string.Empty; 
    if (e.CommandName == "Edit") 
    { 
     //code here 
    } 
    else if (e.CommandName == "View") 
    { 
     //code here 
    } 
    else if (e.CommandName == "GoToWebsite") 
    { 
     LinkButton lb = (LinkButton)e.CommandSource; 
     GridViewRow gvr = (GridViewRow)lb.NamingContainer; 
     LinkButton LinkButton = gvr.Cells[8].Controls[1] as LinkButton; 
     if (LinkButton.Text.Substring(0, 3) == "www") 
     { 
      System.Diagnostics.Process.Start(LinkButton.Text); 
     } 
     else 
     { 
      System.Diagnostics.Process.Start("www." + LinkButton.Text); 
     } 
    } 
} 

로컬 컴퓨터에서 정상적으로 작동합니다. 해당 버전이 표시되고이를 클릭하면 로컬 버전이 확인한 다음이 페이지가있는 새 탭이 열립니다. 서버 (IIS 6.0)에서도 올바르게 표시되고, 클릭하면 도 확인되지만, 페이지가 아닌 새 탭을 엽니 다.

CausesValidation을 변경하면 작동하지 않습니다.
OnClientClick이 없으면 작동하지 않습니다.
LinkButton 위로 (가리 키도록) 이동하면 다시 게시된다는 메시지가 표시됩니다.

이미 감사합니다.

답변

2

"클라이언트/서버"와 같은 생각은 아닙니다.

당신이하고있는 일은 프로세스를 시작하는 것입니다. 모니터 앞에 앉아서 이러한 프로세스를 볼 수 있기 때문에 로컬 개발 시스템에서 작동하고 표시됩니다.

서버에서 프로세스를 시작할 가능성이 높지만 볼 사람이 없습니다. 서버에 로그온하고 작업 관리자를보십시오.

서버 쪽이 아닌 코드의 클라이언트 쪽에서 링크를 여는 솔루션을 찾아야합니다. (HTML과 자바 스크립트로 할 수있는 모든 것은 포스트 백이 필요하지 않습니다.)

+0

그래, 그 대답은 completly true라고 생각하면 ... 고마워요, 그 방법을 찾으려고 노력할 것입니다. 그러면 JS가 잘하면됩니다. – DatRid

+0

하하 글쎄, 정말 서버 allways에서 iexplorer.exe를 엽니 다 ... 재밌 네요, newb로 내 잘못. :) – DatRid

+1

링크를 작성하고 대상 속성 및 기존 확인 코드를 사용하기 만하면됩니다. – Alexander

관련 문제