My aspx pages arent found when debugging.
ASP.NET Web Application using aspx pages (not MVC).
I have the following HTML code:
<Head title="WhycantIdebugbutafterdeploythisworks" url="#">
<MenuItem title="Some Menu" url="/ApplicationName/AFolder/First.aspx" />
<MenuItem title="Another Menu" url="/ApplicationName/AFolder/Second.aspx" /></Head>
After publish the aspx pages are found and display correctly: url=http://ApplicationName/AFolder/First.aspx, but when I debug my app, it can't find the aspx pages and gives error message "The file '/ApplicationName/AFolder/First.aspx' does not exist.". The debug url=https://localhost:44322/AFolder/First.aspx.
If I remove /ApplicationName from the url HTML attribute, the debug works but the deployed version does not.
How to fix the HTML so that the url works both in debug and on IIS?
As a general rule, you don't include the "app name" in ANY of your url's.
You need to supply JUST the path name to the folder, and then the web page.
And you can specify "root" with a "~/" but ONLY if you have a runat="server" tag.
So, your urls can be say like this:
<MenuItem title="Some Menu" runat="server" url="~/AFolder/First.aspx" />
<MenuItem title="Another Menu" runat="server" url="~/AFolder/Second.aspx" />
Now, you can in most cases use just /Afolder/xxxx.aspx, however that WILL BE relative addressing from your current web page, and thus most menu's will not work if you sitting in a different locaiton or folder.
So, when possbile, try to add/use the runat="server" tag, and thus the system will resolve AND ALLOW use of the "~/".
The use of "~/" is not legal in javascript code, and it not in most cases for a simple hyper link.
However, for code behind such as response.Redirect("~/somefolder/xxxx.aspx"), the you are fine.
And for a hyper link control on a page (or menu)?
As noted, you can include/have/use the "~/" if the control in question has a runat="server" tag.
That way, the base root URL of the site will not matter, and MORE imporant should never matter.
So, since a asp.net control like a hyper link has the runat="server", then this URL is legal:
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Test/GridRadio.aspx">HyperLink</asp:HyperLink>
However, if you use a plain jane HTML link, then you can NOT use the "~/" in above. (and that means you have to take into account the folder you are in).
So, if I am in say folder Grids, and I want the above link?
I have this
http://localhostxxxx/Grids/MyGrid.aspx
And I want to navagate to
http://localhostxxxx/Test/GridRadio.aspx
Then a plane jane (non server) side like will look like this:
link text
So, note how we have to "come down" one folder level with .., and then go back up to test folder.
However, with server side controls, as noted, you can (and should) always use the "~/folder/page.aspx" type of format, and it will always work for you.
So, don't include appname, don't include host name either, everything should ALWAYS be a path from your root folder, and in 99% of cases then, use "~/" with a server side control.
So, if you choose to "always" use relative addressing, then you MUST take into account the current page "nesting" as to where your current page sits, and the target page you want to navigate to.
Related
in html file i can make
<h1> the following page is google page </h1>
<pageElement linkForThePage='google.com'/>
how can I open any page inside the marginal page without leaving it? is there an HTML element that do this.
in case you did not understand what I mean: I want to open other pages like google authentication as a component (like opop up but I don't want to make a popup) in my original page.
UPDATE: I had come up with the iframe approach to load a website within the component. However, all the websites with authentication pages like google, facebook will block framing.
You need to use iframe within your Component That you wanted to link to.
const MyWebSite = ({siteName})=>{
return(
<iframe src={siteName} title="My Site Name">
</iframe>
)
}
Then from Parent Component Use this Component.
<MyWebsite siteName="https://aperfectplate.co/" />
Update: While the above website will work and food app is loaded.
Codesandbox: https://codesandbox.io/s/iframe-example-nihyh?file=/src/App.js
But authentication websites will not be loaded within the component with the above approach. For example if you try below code. It wouldn't load google.com.
<MyWebsite siteName="https://www.google.com/" />
That's what I feel can be done. You may improve it later using React Router. You can make it behave like a link also. This idea could be used to build on top of :)
I was working on tag and let say my domain was www.abc.com. If I use href="http://example.com" it does properly navigate to intended url. However if I use href="www.example.com" it doesn't navigate to intended url.
not properly navigate
properly navigate
properly navigate
I was reading the anchor specs in https://html.spec.whatwg.org, unfortunately could not find this specific case.
The browser must know if you want to link to another website or a different file/page of your own website. The browser always asumes that you want to link to a file on your own server if you do not specifiy the protocol.
In fact: The only reason you can leave the protocol out when typing a url into the addressbar of your browser is because the browser just asumes that you want to use the http-protocol. This is not possbile with urls inside the A tag.
If you don't specify an absolute url it will think it's a route inside your site.
Possible values using href attributes:
An absolute URL - points to another web site (like href="http://www.example.com/default.htm")
A relative URL - points to a file within a web site (like href="default.htm")
Link to an element with a specified id within the page (like href="#top")
Other protocols (like https://, ftp://, mailto:, file:, etc..)
A script (like href="javascript:alert('Hello');")
Because When you click on it.. Your Browser Will suppose he need to find this link in the same file extension.
Example: if your html file extension is e://tst.html
when click on tag at Browser it will go to e:// and search about file with name "www.google.com" and not find it..
Use not properly navigate to inform Browser you need to navigate to Another website
I'm making a custom masterpage and on the navigation bar, I would like to have a button which goes back to the current site main page. This masterpage will be use for other subsites as well. Is there a way for me to get the current site URL within the index file?
You can use URL Tokens to get your site URL.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="homelink">
</SharePoint:SPLinkButton>
Notice the URL token of ~site used in attribute NavigateUrl="~site/". You may have to use the $SPUrl command also.
<%$SPUrl:~site/myPage.aspx%>
You can also refer to this discussion for more usage examples.
NOTE: I haven't tried the above examples, but these should be sufficient to provide you a path to your answer.
This is weird!
I have set up a form using RapidMailer, and on an external site it works fine. (Just to complicate matters, the form is within a <div> as I display a background image, and then use the <div> to position the signup box halfway down the page)
But ...
Put it within an Facebook (Thunderpenny) StaticHTML page, (which I think is <iframe>?) and whilst I can enter name/email, and the submit button shows mouse up/mouse down events, it just won't submit.
I tried adding "pointer-event:auto" to the div so that it was to the fore, but no go. And no good asking the app creator as I doubt I'll get a response. Anyone any ideas? (** I could include page code, but it's 90% links to external js files Rapidmailer sets up)
Is it 'cos I got a <div> within an <iframe>? Do I need to add an <object> to the code somewhere???
It turns out that for some reason, the HTML code cannot find / use the javascripts even with direct URL's. I strongly suspect it's to do with "cross browser" limitations. In otherwords, the StaticHTML <iframe> is on one server, and the HTML code is trying to access javascript on a second server. And as the RapidMailer script is using three scripts direct from jquery.com, it's difficult to know what can be eliminated as they all contain error trapping routines.
In the end, I had to add a direct link to a status update on the Facebook page, and redirect it to the signup form on my blog. I then pinned the post the top. Alas, now for some reason it won't display a graphic with the link, and instead insists on showing the URL itself! Oh well!
I have a WordPress custom page that has the following image coded in it (CSS in another file applied to a class of this image, just shortening the story here):
<img src='wp-content/themes/MyTheme/images/someimage.png' style='display: none;' />
Once I upload everything on the server it all works fine. However, after a while I can see that the source of that image changed to something like this:
<img src="data:image/png;base64,iVBORw0KGgo...uQmCC" style="display: none;">
This is a huge problem as (long story short) I need to have that image loaded on the page not as a data URI scheme but a regular source link so it is correctly displayed if certain events on the page happen (it works fine before the src is changed and it doesn't after).
Since data URI scheme is new to me how can I prevent it from happening and have the regular source link always displayed? (mind you, at this point I'm not sure whether the WordPress is responsible for it or the server itself)
Any tips would be greatly appreciated, thanks!
It's possible that you have PageSpeed modules enabled that are doing this on your website. Had similar issues before.
You can enable and disable modules by using an htaccess file at the root
of the website using flag to set your preferences. This page explains
how:
https://developers.google.com/speed/pagespeed/module/filters