I am using ASP.NET and I am trying to make a link in my home page to Login page and Register page. I am getting the error
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I have this code :
<tr>
<td>Login</td>
<br />
<td>Register</td>
</tr>
the page is there where I said it is.
but if I write this code, it works.
<tr>
<td>Login</td>
<br />
<td>Register</td>
</tr>
Why can't I write without .aspx extension ?
I've seen enough examples where developers didn't write the extension.
What is the problem here? Why is this happening?
For example, here :
http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/ui_and_navigation
<AnonymousTemplate>
<ul class="nav navbar-nav navbar-right">
<li><a runat="server" href="~/Account/Register">Register</a></li>
<li><a runat="server" href="~/Account/Login">Log in</a></li>
</ul>
when u don't want to show the exyensions u have to use httphandlers to mask the url other wise .net compiler don't know how to compile the code
Related
When creating a standard asp.net web site with vs2013 I notice that no site map is used and I also note that the menu created is a new nav bar class.
You get this as a default:
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a runat="server" href="~/">Home</a></li>
<li><a runat="server" href="~/About">About</a></li>
<li><a runat="server" href="~/Contact">Contact</a></li>
<li><a runat="server" href="~/Upload">Upload Files</a></li>
<li><a runat="server" href="~/Portal/UploadCust">Customer Portal</a></li>
</ul>
So, no site map is used here. And the menu system in asp.net NOW does not use the site.map. What is the suggested approach NOW THAT NO SITEMAP is used in these templates to hide a given menu based on role?
Is the suggestion to create a sitemap by hand? and then simply enable trimming as was done in the past? I have role permissions working fine (sql providers) but I am perplexed why this new menu system does not support nor have anything to do with site maps? I am simply looking to hide menu options based on role membership but am at a loss as to why the default menu systems don't use sitemap anymore? Right now users just get a 404 error.
So is some suggested way to hide menu options in above or is it still best to adopt a site map and enable trimming? This being the case then must I drop use of the above new nav bar class?
edit:my current solution is to add a id like this
"<a id="PortalLink" runat="server" href="~/Portal/UploadCust">Customer Portal</a>
And then in the web site on-load in VB, I use this:
If Roles.IsUserInRole("Portal") Then
Me.PortalLink.Visible = True
Else
Me.PortalLink.Visible = False
End If
I followed this tutorial Use external RSS feed in ASP.NET website - Visual Studio 2010
To try and display a Facebook rss feed on my website.
This was the resulting code:
<form id="form1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server" DataSourceID="XmlDataSource1">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li><%#XPath("title") %></li>
</ItemTemplate>
</asp:ListView>
</div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="http://feeds.bbci.co.uk/news/rss.xml?edition=uk"
XPath="rss/channel/item"></asp:XmlDataSource>
</form>
With nothing in the codebehind file.
This seem to work with pretty much any RSS feed. But if I try with my Facebook RSS feed:
http://www.facebook.com/feeds/page.php?format=rss20&id=1425042407719904
It falls over with the following error:
An error occurred while parsing EntityName. Line 9, position 30.
Is there something extra needs doing when consuming/parsing a Facebook RSS feed?
Thanks.
Ok. Never did find the reason for this. In the end I routed the feed via feedburner.com which seemed to resolve the issue.
i need your help.
I have an home button (it exactly is ) in masterpage use for all aspx. Pages is my folder name (it containts my aspx webpages) and it has an "Admin" folder inside (it containts my admin page). It works in all of pages except admin page. when I clicked "Home" from admin page I got "The resource cannot be found." error, and the Url in web browser's address bar is "localhost/Pages/Pages/Home"
I don't know why i get two "Pages" in the Url.
help me please
table>
<tr>
<td width="700px">
<ul class="menu">
<li>Trang chủ </li>
<li class="Parent">Sản Phẩm
<ul>
<li>Điện thoại </li>
<li>Máy tính bảng </li>
<li>Phụ kiện </li>
</ul>
</li>
<li>Giới thiệu </li>
<li>Góp Ý </li>
<li>Đăng nhập </li>
<li>Đăng kí</li>
</ul>
</td>
<td width="300px">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Label ID="lblUser" runat="server" Font-Bold="True" ForeColor="White"></asp:Label>
</td>
<td>
<asp:HyperLink ID="HyperQuantri" runat="server" Font-Bold="True" ForeColor="White"
NavigateUrl="~/HienThi/ThongTin.aspx">Thông tin</asp:HyperLink>
</td>
<td>
<asp:HyperLink ID="HyperThoat" runat="server" Font-Bold="True" ForeColor="White"
Visible="False" NavigateUrl="~/HienThi/Thoat.aspx">Thoát</asp:HyperLink>
</td>
</tr>
</table>
</td>
</tr>
It sounds like you may have some relative pathing issues with your links. This gets particularly tricky when you're using master/child pages or template controls in a site where you have various depths of folders.
Since you're using web controls, try renaming your links using the following format:
~/Pages/Admin/Default.aspx
The ~/ directive will tell ASP.Net to build the path of the link from the root of the site, so no matter which page the control resides on, it will generate the proper link.
I have follwing code
<div class="main" data-role="content">
<div class="choice_list menuwrapper" >
<ul data-role="listview" data-inset="true">
<li><a href="CreateUser.aspx" data-transition="slidedown" >
Create User
</a></li>
<li><a href="WebForm1.aspx" data-transition="slidedown">
Manage User
</a></li>
<li><a href="Default.aspx" data-transition="slidedown">
Upload File
</a></li>
</ul>
</div>
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>`
but when i try to click any button on createuser or other page the button_click event is not firing in asp.net and the page redirects to default.aspx,
I found when gooogled that using
$(document).bind("mobileinit", function () {
// jQuery Mobile's Ajax navigation does not work in all cases (e.g.,
// when navigating from a mobile to a non-mobile page), especially when going back, hence disabling it.
$.mobile.ajaxEnabled = false;
$.mobile.ajaxLinksEnabled = false;
});
it will solve, but no luck in my case,
Could somebosy please help me.
Thanks
I had a similar issue with a rather large mobile project. We also ran into other bugs when using .NET masterpages with jQuery Mobile. We ended up not using a masterpage in the end because there were just too many issues.
Try adding data-ajax="false" in all of your links. That should be what the code you posted is doing, but it might not be working depending on the version of JQM you're using.
I'm using ASP.NET MVC & CKEditor (Basic) to get input (almost exactly like this stack overflow RTE.) User's are limited to bold,italic,links.
I'm assuming I need to validate this server-side, incase someone issues CURL requests to my controller with any desired HTML in it. (I.E so they weren't limited by client-side validation).
So I need to allow, bold, italic, link tags, lists, but absolutely nothing else, how can this be achieved? I'll have a custom validator on my view model, but what is the best way to structure this custom validator? What to look for etc?
This could be achieved through regex and negative lookahead.
Something like that <(?!br/|br /|a|/a|strong|/strong|b|/b|i|/i|ul|/ul|li|/li>).+?> would match all tags except <br />, <a></a>, <strong></strong>, <b></b>, <i></i>, <ul></ul>, and <li></li>.
Then you could replace the matched occurences with an empty string.
For example this input (tested on regextester.com) :
test test link
Some <strong>text in bold</strong> and <b>another one</b> but also something
in <i>italic</i>
<ul>
<li>Now</li>
<li>a list</li>
</ul>
<table>
<tr>
<td>And a table</td>
</tr>
</table>
<br />
<hr />
Would become :
test test link
Some <strong>text in bold</strong> and <b>another one</b> but also something
in <i>italic</i>
<ul>
<li>Now</li>
<li>a list</li>
</ul>
And a table
<br />