ASP.NET HyperLink - asp.net

I have written an server side hyperlink which will redirect to 'landing.aspx' page. Below is the code
<asp:HyperLink ID="HyperLinkLT1" runat="server" Text="Link Text" NavigateUrl="landing.aspx"></asp:HyperLink>
This is working fine in chrome. Now the problem is when I run the project in Firefox and click on the link, I am getting a popup which says error and them the page is redirected. Below is the screen shot.
Can someone help me to identify and clear the problem.

Related

404 error on link button click to valid website address

When a user clicks on this particular link button in question, I receive a 404 error in the browser. When I click the refresh button on the browser, the target website loads as normal. Any thoughts on what this might be? It's just a plain old .net link button:
<asp:LinkButton ID="lnkWhatAre" runat="server" ForeColor="#FF9999"
Style="text-decoration: none" CausesValidation="false"
PostBackUrl="http://www.targetsite.com/">WHAT ARE?</asp:LinkButton>
PostBackUrl causes page to perform POST request, not all target pages like it. If you simple mean to provide a navigation link you can use something like this instead:
<asp:HyperLink ID="lnkWhatAre" runat="server" ForeColor="#FF9999"
Style="text-decoration: none"
NavigateUrl="http://www.targetsite.com/">WHAT ARE?</asp:HyperLink>
"asp:HyperLink" is a server-side control, so you can still set all its properties in server-side code if needed. And it renders as a normal hyperlink - so it won't cause any problems redirecting.

asp.net page postbacks when mouse is moved over embedded youtube flash video

I am developing a site in which youtube video’s will be added to asp.net page using the HTML code given at youtube.com site. When I run the program, in the web page youtube video is displayed. But the strange thing is when I move mouse over the video display area the page postbacks happens. I am able to find this when I run the program in debug mode.
To exactly reproduce the scenario, I am writing the steps which I have done in my project.
1) In visula studio 2010 > Open asp.net web application project (with c# as language)
2) add some page, say cat.aspx
3) in cat.aspx write the code as below
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblVideo" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
4) in cat.aspx.cs, in page_load even write the following line
lblVideo.Text = "<iframe width=\"620\" height=\"349\" src=\"http://www.youtube.com/embed/WoTsE7pbuKg\" frameborder=\"0\" allowfullscreen></iframe>";
5)you can replace the above given by youtube.com, but be sure to set "http:" and escape " with \" as how I have done.(to get HTML code for any youtube video, visit www.youtube.com, click on any video or a famous song, below the video a menu "share" will be displayed, click on it, then another option "Embed" will be displayed, click on it, you will be presented with code)
6)Now run your web app project, you can see, youtube video is displayed.
7)Now run with break point set in Page_load event, now move mouse over the video display area, you can see for each time the mouse enters the video display area, a postback happens.
8) I have latest flash installed in firefox and InternetExplorer, this problem happens only in firefox and IE, not in chrome. And this problem happens only when we use Updatepanel. I also found that page does not postback (IsPostBack) is false when every time the control hits the codebehind. It is like page is requested for the first time as how we type the url in the address bar and press enter
I tried using asp:PostBackTrigger and asp:AsyncPostBackTrigger
Both are not giving solution to the problem, because what happens is not postback, it is fresh page request
Many Thanks in advance to anybody who try to help or give solution.

ASP.NET Login control focus in FireFox

I am using the Login control. Just in FireFox, I am finding that I cannot click directly on the UserName field. I need to tab through all the other elements on that page. Just wondering if there is a work around to this issue?
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false" OnLoggedIn="LoginUser_LoggedIn">
You can do this by adding the following code to the Page_Load method on your login page:
AppLogin.Focus();
this.Form.DefaultButton = "ctl00$BodyPlaceHolder$AppLogin$LoginButton";
This will also cause the "login" button to be clicked when you click enter.
Note: The full "path" (ctl100$BodyPlaceHolder...) may vary slightly depending on whether or not you're using master pages, panels, etc. You can simply view the element on the page in your favorite inspector and find the rendered name for the login button.
More details can be found at my blog here.

Opening Explorer with HyperLink in GridView Using file://

I am trying to open Explorer on the client side to view a directory. In my aspx webform, I have a gridview, which has a column of hyperlinks. In the aspx markup, I have the following:
<asp:HyperLink Text="ICPnt" id="MyDir" runat="server" Target="_blank" NavigateUrl='<%# "file://" + Eval("MyDir").ToString() %>' ></asp:HyperLink>
When the startup the asp.net application in debug mode with Visual Studio and move the cursor over the hyperlink, I see the popup path,
file://MachineName/C$/WINNT/MyDir
This looks correct. When I click on the hyperlink, NOTHING happens. I don't even see the cursor turning to an hourglass icon or anything. I think I am pretty close but can't see the missing step or error.
Another test:
I typed file://MachineName/C$/WINNT/MyDir in both Windows and Internet Explorer and got a new Explorer to pop up and display the directory content from my VM environment. As a test, I copied and pasted the same exact file:// path to my aspx markup and tested again. When I click on it, nothing happens.
<asp:HyperLink Text="ICPnt" id="WSM2MDir" runat="server" Target="_blank" NavigateUrl='<%# "file://MachineName/C$/WINNT/MyDir" %>' ></asp:HyperLink>
Any help is appreciated. THanks

ASP.NET button click event not working in IE

in my asp.net page, The asp.net button click is not getting fired in IE,But in mozilla its working fine. Any thoughts ?
I've had a similar problem when using a non runat="server" form nested inside a runat="server" form or vice versa, like so:
<form runat="server">
.... Some code
<form method="post" action="somepage.aspx">
</form>
.... Some more code and a button
</form>
The first form seems to get closed when the inner form is closed so any buttons after the closing tag of the second form don't postback
Javascript error specific to IE is my guess. Do you get the "error on page" message in IE?
It could be a security settings problem. It maybe that your settings do not allow javascript to run from sites in the "internet zone". Try adding your site to "trusted sites", then refresh the browser, and try again.
I'd also check for malformed HTML or any additional script that might interfere or intercept the postback unreliably.

Resources