ASP.NET change in the content of the asp-page - asp.net

I have a iframe in the site, and I want to add a specific text into url.. But I would like to know how I can respond to the url of the site..
How can I add<%= %> into the url,
Iam using forms, how should I be able to return the url
FOr example
<iframe src="http://www.facebook.com/plugins/like.php?href=<% %> &layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

The easiest way to implement this is to build the iframe html tag in runtime and then add it to a control like Literal. There are much more ways but I think this is the best way for you.
Hope it helps

Related

Iframe does not work correctly in ASP.Net?

I have a ASP.Net Web form application project.
I use Google iframe but it does not work.
Please help me.
My code:
Location="https://www.google.com/maps/place/%D8%B4%D8%B1%DA%A9%D8%AA+%D8%AC%D9%87%D8%A7%D9%86+%D8%B4%DB%8C%D9%85%DB%8C+%D8%A8%D8%B3%D9%BE%D8%A7%D8%B1%E2%80%AD/#35.7743752,51.3679948,14z/data=!4m8!1m2!2m1!1sjahan+shimi+baspar!3m4!1s0x0:0x9f32a31df4793a64!8m2!3d35.7721173!4d51.3661373"
<iframe width="100%" height="400px" scrolling="no"
src="location"></iframe>
Just use google's provided embed code:
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d25896.326046334627!2d51.3679948!3d35.7743752!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x9f32a31df4793a64!2z2LTYsdqp2Kog2KzZh9in2YYg2LTbjNmF24wg2KjYs9m-2KfYsQ!5e0!3m2!1sen!2sus!4v1473145596653" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
Your src="location" doesn't automatically read some "location" variable/parameter/whatever, it just tries to use the value "location" as url and fails.
So you need to use some way to inject the contents of your Location variable as value of src.
How to do that depends on how you generate that HTML:
For webforms you may need something like src="<%= Location %>".
For MVC it will be something like src="#Location".

Avoid browser cache in asp.net

I try to disable the html url browser cache using programmatically.
I am developing as a site using asp.net, I need to disable the html url browser for the security reason.
I tried many ways to disable the cache but none seems to work. Any ideas?
<iframe id="iframe" src="http://www.phy.mtu.edu/basiccomputing/sample.html" runat ="server" width="200" height="300"></iframe>
As far as it's a html file you want to work with, a easy solution is to append a random number and the end of your url like this
<iframe id="iframe" src="http://www.phy.mtu.edu/basiccomputing/sample.html?12345" runat ="server" width="200" height="300"></iframe>
I don't know wich view engine you are using, so i cant provide a sample you simple copy and paste.
You have to replace ?12345with a random number like new Random().Next().ToString()
If you call a asp.net page you can control it with
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
more informations about that:
ASP.NET Cache Examples
hope this helps
You could attach a random parameter to the URL so the browser thinks it's a different page every time.
http://www.phy.mtu.edu/basiccomputing/sample.html?rand=[INSERT RANDOM HERE]
try
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)). This site has something that can be quite helpful.

FCKEditor and ASP.NET CSS

I've got an ASP.NET webforms project, and I want the fckeditor to use the stylesheet of the site so that people without HTML knowledge can look at the site and make changes.
Here is my current code:
<fckeditorv2:FCKeditor runat="server" ID="txtPageContent" Height="600" BasePath="~/FCKeditor/" ForceSimpleAmpersand="false" FormatOutput="false" EditorAreaCSS="../App_Themes/Professional/master.css"></fckeditorv2:FCKeditor>
As you can see, I've set the EditorAreaCSS property but it still doesn't put up the styles.
Instead of the ../App_Themes I've tried ~/App_Themes and /App_Themes but nothing.
The stylesheet certainly exists, and I've tried setting this in both the code behind and in the ASPX file.
When looking at the source, I get this in the hidden field that fckeditor makes:
<input type="hidden" id="ctl00_contentMain_txtPageContent___Config" value="ForceSimpleAmpersand=false&EditorAreaCSS=../App_Themes/Professional/main.css&FormatOutput=false&HtmlEncodeOutput=true" /><iframe id="ctl00_contentMain_txtPageContent___Frame" src="/eJs.Web/FCKeditor/editor/fckeditor.html?InstanceName=ctl00_contentMain_txtPageContent&Toolbar=Default" width="100%" height="600px" frameborder="no" scrolling="no">
Any ideas would be most appreciated.
I hope this will help. Probably best would be set it from code behind
EditorAreaCSS = this.ResolveUrl("~/App_Themes/Professional/main.css")
ResolveUrl() method is Page method, actually any System.Web.UI.Control should have it

iframe refresh banner code NO PAGE REFRESH

how do i create a iframe refresh ads banner code NO PAGE REFRESH ,not adsense
example =>
<div align="center">
<iframe src ="http://www.1pars.com/ads/2.html" id="I1"
name="I1" align="center" height="63" width="500" "border="0"
frameborder="0" scrolling="no" marginheight="1"
marginwidth="1"><p>Your browser does not support
iframes.</p>
It's simple as this:
<iframe src="../../../index.htm">
<p>Your browser doesn't support frames. You can visit the site directly via
this link.</p>
</iframe>
The linked index.html needs to have this in its header:
<meta http-equiv="refresh" content="15; URL=index.html">
The question is fairly generic; however, if you want to just have an iframe load a banner image, and then have that banner image refresh dynamically, the best choice to me would be an ajax request to the server to fetch your next image to use, and then insert the new source url into your image tag on the page.
Alternatively, your iframe banner page could contain some images on it, and some javascript to rotate between the predefined images.
However, without knowing a more complete issue, that's the best answer I can give.

Add Like Button ASP.net

I'm a novice asp.net developer and know next to nothing about javascript.
I know this should be easy but...
I think I need to add a Facebook Like button to a asp.net (C#) website. When a user clicks, it should add a reference to my site onto their Facebook wall - if it first takes them to a Facebook login page that's fine. I'm not sure the Like button is the correct control for this. I've looked into using the C# Facebook SDK on codeplex but there's no documentation and the samples don't seem to do anything.
I've taken the following code from the facebook dev site:
<iframe src="http://www.facebook.com/plugins/like.php?href=www.blank.co.uk&layout=standard&show_faces=false&width=450&action=like&font&colorscheme=light&height=35"
scrolling="no" frameborder="0" style="border: none; overflow: hidden; width: 200px;
height: 200px;" allowtransparency="true"></iframe>
This doesn't seem to do anything except increase the counter value next to the text box.
Could anyone please advise best way to implment this functionality. If there's any good documentation / tutorial for using the C# Facebook SDK that could be very helpful since it's likely I'll need to implment more Facebook integration in future.
Many thanks
Rob.
Did you follow the steps at https://developers.facebook.com/docs/reference/plugins/like/?
Here is the iframe for http://stackoverflow.com that just takes the defaults:
<iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fstackoverflow.com&layout=standard&show_faces=true&width=450&action=like&font&colorscheme=light&height=80"
scrolling="no"
frameborder="0"
style="border:none; overflow:hidden; width:450px; height:80px;"
allowTransparency="true">
</iframe>
Here is the XFBML for http://stackoverflow.com that just takes the defaults:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="http://stackoverflow.com" show_faces="true" width="450" font=""></fb:like>
Have you tried using the XFBML code that can be generated on the Facebook Like Button page?
It looks straing forward enough that this should work for you.

Resources