I have created a mvc project but found I need to add a webforms page. I have tired a few variations of this but have only gotten 404 errors. Seen a few suggestions elsewhere and settled on this:
function ViewRunSheet() {
var route = document.getElementById('Route').value;
var routeDate = $("#RouteDate").find("input").val();
window.location.href = "./RunSheet.aspx?route=" + route + "&date=" + moment(routeDate).format('YYYYMMDD');
}
Has anyone got any ideas as to:
Why this method doesn't appear to work
If there is a better solution I should be using
Also its my first question so if I have missed anything major I will edit it in
EDIT This is Running locally on my system and is not deployed via IIS
EDIT Since posting I have been playing around and decided to test moving the web form out of my views folder directly into the root folder and now the code works. This is good however I am intrigued to know why if anyone knows
You may need to add below in route.config file to ignore the routing for aspx page
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
Related
I have been developing a website that can display some data. In the table, there is a button in each row to open a new window, where the user can see data related to that line.
I am using MVC 6 and I used Javascript to open the window and passing the 'id' parameter through querystring.
My code is:
The Parent View .cshtml:
The Button:
wButtonClass = "btn btn-warning openW";
<a href="javascript:void(0);" class="#wButtonClass" data-id=#id.ToString()>#buttonText</a>
The Script:
<script>
$(document).ready(function () {
$(".openW").click(function (e) {
var x = $(this).data("id");
var new_window = window.open('/MyView/HandleButton?id='+x, '_blank', 'left=200,top=150,width=1000,height=800,toolbar=1,resizable=0');
});
});
</script>
The Controller:
public IActionResult HandleButton(int id)
{
//Filling the List
return PartialView("DataView", myList);
}
So, it is working just fine from VS, but when I deploy the project to an IIS server (not on my machine), it opens the new window, and says "404 - Not Found", although the URL in the newly opened window is correct (the value is passed)
What could be the problem?
I've been looking through several forum questions, but couldn't find an answer.
Update 1:
Well, technicalliy, in the popup window, the URL is:
http://localhost/MyView/HandleButton?id=5
And it says in the 404 Error Details:
Requested URL http://localhost:80/MyView/HandleButton?id=5
Physical Path C:\inetpub\wwwroot\MyView\HandleButton
Update 2:
Well, I have finally found an answer. It looks very silly, but solved the problem.
I found it here:
IIS 8 Can't see partial view
I had to change the URL and add the application name:
So, instead of: /MyView/HandleButton?id='+x
I Typed: /MyWebApp/MyView/HandleButton?id='+x
Well, it works on the server, but doesn't work in VS. It will be fine (I just change the URL everytime I debug), but is there a way to do this more elegantly?
This could be expected if the routing is incorrect and the URL is incorrect. However, since your URL is correct and you still seeing a 404 error, it likely is an issue with the server configuration.
Verify that the IIS server has the correct permissions to access the
files and folders of your application.
Check that the IIS server has the correct .NET Framework version
installed and that your application is targeting the correct version.
Make sure that the IIS server has the correct MVC version installed
and that your application is targeting the correct version.
Check that the IIS server is configured to handle requests to the
.cshtml files.
Make sure that the MVC routing is configured correctly in the
web.config file of your application.
Check whether the IIS server is running in 32-bit or 64-bit mode.
Make sure that your application is built for the same mode.
Confirm that the server is able to find the DLLs and assemblies that
your application needs.
Check the event logs for any info.
This is italicized, and so
is this.
This is bold, just like this.
useEffect(() => {
var aScript = document.createElement("script");
aScript.type = "text/javascript";
aScript.src = "./js/main.js";
}, []);
You can combine them
if you really have to.
I upgraded dotcms from 2.5.7 to 3.7.2.
The following code is actually linked to a button which opens a slideshow.
This code was working in old cms, but won't in the 3.7.2
Funny thing! - If I am not logged in in the backend this code works otherwise it won't.
To view the button for slideshow itself you need to be logged in, but not in the backend!
What am I missing guys?
How should I get list of files from folder which have 4 children (folders in it), that contains pictures and then I could use it with JavaScript?
#set($folder = $fileRepository_filesList.get(0).folder) - this line should return id of the folder, but does not return anything (it's just $folder). If I'm logged in the backend this line returns id(61763395-ca41-4446-95cc-4ddfbaaf0cea). Why?
Thank you so much for the help!
So my guess would be that CMS Anon does not have read access to the files. You could try to get the folder ID using something like,
$folderAPI.findCurrentFolder("/path", $host).id
where the path is the folder path you are looking for. Also, why would you be upgrading from an EOL'ed version to another EOL'ed version - you would be better off going to the latest version.
I'm using a JavaScript, along with PHP, to create a login system for a project I'm working on.
I have everything working in regards to actually logging the user in, and then checking this within my JavaScript. However when I redirect the user from the login page to a private page, I'm having issues with window.location.href in the JavaScript.
I own the domain thomas-smyth.co.uk, so I have tried the following piece of code to redirect the user.
window.location.href = "http://thomas-smyth.co.uk/home.php";
However, when this redirects me, it is redirecting me to thomas.smyth.co.uk, which obviously causes the page not to load. Any ideas on how I could fix this?
Thanks in advance,
Tom
You have posted the wrong code. In your Js File thomas-smyth.co.uk/functions/login.js on your webserver is this:
//Re-directs to subdomain.
window.location.href = "http://www.thomas.smyth.co.uk/home.php";
this should be fixed to
//Re-directs to subdomain.
window.location.href = "http://thomas-smyth.co.uk/home.php";
#vlaz mentioned right, you have a second mistake with a wrong dot instead of a dash
And btw you should explain your problem a bit more. More code would be usefull next time if you want some help.
Normally with JavaScript you can use the following to manipulate the history, but it does not work.
Example: What I want to achieve is to go to /clients/:id and then when I go back, I want to go to /blog/, doesn't matter which page i was on before.
$scope.changeView = function(clientId){
history.pushState({}, null, '/#/blog');
$location.path('/client/' + clientId);
};
However, this does not work in Angular.
Any idea how this could be solved?
As I am confused about what your question is.. (Are you just trying to find an Angular way of manipulating the history? Or are you trying to redirect?)
Something that may be of interest to you is the $location service on AngularJS.
I just used history.pushState(), null, '/aboutus') while on a page within my app, clicked a link, then went back and it seemed to load that '/aboutus' link just fine, so long as your Angular app is configured to route that path somewhere.
This may be too obscure a question, but perhaps someone can spot what I'm doing wrong.
Phono (jquery plugin for javascript/flash-based softphone built on top of Tropo/Voxeo) loads a couple of dependencies from the phono.com servers. Namely,
flensed.js
checkplayer.js
swfobject.js
phono.audio.swf
I would very much like to avoid loading these dependencies from an external server (for obvious reasons) and going by this thread on their forums (which I can't register for because it appears every possible username has been "taken") , it should be possible to host them locally.
Here's a prettified source for the main jquery plugin. Maybe I'm just bad at looking, but I could not find a commented, un-minified version either in their full SDK or on github.
So after changing
base_path: "http://s.phono.com/deps/flensed/1.0/"
and
swf: "http://s.phono.com/releases/" + Phono.version + "/plugins/audio/phono.audio.swf"
... all dependencies seem to load just fine, phono successfully grabs a session ID and chats by SIP appear to be working. When I try to dial out or call the session id/SIP, however, I get a javascript error:
Uncaught TypeError: Cannot call method 'start' of null
referring to line 770 : h.start().
this.$flash.play(g, j); appears to return null or undefined. I suck at javascript and can't figure out why.
EDIT - if anyone would be so adventurous as to try this out, you can just grab their "kitchen sink" demo and slap it up on a server without much hassle.
Okay -- this is ridiculous and I'm an idiot for not catching it sooner.
Flash was trying to load the ringtones off my server at the URL that requires authentication. Unfortunately, flash is not a user with a valid session. Hence, flash was grabbing big handful of nothing. Sorry.
You can download the PhonoSDK and all of the samples (including the kitchen sink demo) and run it on your localhost. Here's the link: http://s.phono.com/releases/PhonoSDK-0.2.zip. It's open source, do you can also fork/contribute to the project as well - https://github.com/phono
I just tried it using Apache on my localhost it worked without editing anything.