ASP.Net Razor Page generates wrong URL - asp.net

I have this Page '~/Pages/Topic/View.cshtml' that uses a layout '~/Pages/Shared/_Layout.cshtml' in my project. The problem is when this Page is rendered all Anchor tags generates a reference to the page itself ('~/Pages/Topic/View.cshtml')
Please, how do I fix this?
Note: You can connect to my computer using TeamViewer on other related remote App and solve this for me.
Below is _Layout.cshtml using the _Nav.cshtml

Try adding a forward slash in front of the page name:
asp-page="/Department"
Edit:
I just tested this using the same scenario you described and it works. You must have additional code somewhere causing issues, or you are trying to use MVC with Razor Pages and it's causing issues.

Related

.net 6 MVC Razor site - loginPartial links don't open the page, routing issue? How can I fix this?

Basic site from the create project wizard, I added the Identity scaffold like I have done in the past.
Added the partial to include the _LoginPartial on my template nav bar. However, the links don't open the page.
It stays on the current page and the Areas are there.
The links look default and I haven't changed them.
If I go to /Identity/Account/Login it renders a 404. Is there any special routing I need to do? I thought it does this automatically.
Have to add app.MapRazorPages(); to the Program.cs
The app is not smart enough to add when adding the Identity scaffold to the application.

Update Panel in web part not working in Google Chrome

I have written a visual web part for SharePoint 2013 in VS2015. The web part contains a number of asp controls as well as a grid view. I implemented AJAX with using script manager proxy and update panel. The deployed web part works well in IE but in google chrome, it doesn't work. I have found the solution on the internet. http://www.jquery2dotnet.com/2011/11/update-panel-not-working-in-google.html. I have put the code in js file in layout folder. In scriptmanager add reference to the file Path="/_layouts/15/prj/WebKit.js". However, it is not working in chrome. Could anyone please tell me how to solve this issue?
There seems to be an issue with SharePoint + UpdatePanel.
I've had the same problem and found the following article:
https://msdn.microsoft.com/en-us/library/ff650218.aspx
To be honest, I couldn't apply the proposed solution, because I couldn't find the requested dll.
So, to solve my postback problem, I saw two possibilities:
1. Use DevExpress
2. Change my code to client side.
I chose the second option.

add new page to existing website without modifying the rest of the website

i have to add one page to an existing asp.net webforms website.
this will be added at runtime and i'm not allowed to redeploy the entire webapplication / website.
is the (recommended or only) solution to move the code behind code to the aspx file, or do i have other options?
i can't put code in the dll's, and dynamicly runned .cs files are only in the case of a website and not in the case of a webapplication, am i right?
and putting the code from my code behind in de aspx file will always work?
actually as long as their page link to yours via URL you web page doesn't necessary have to be in the same project, unless you're trying to reuse something.
Else technically your project is fine as a standalone and they can just link to yours.
Unless you're worried about the URL then you would have to either use an iframe or some other URL rewrite.
Just for reference: One solution would be to use a dynamic proxy and intercept and extend the existing webapp. Though this approach might be a little too involved for what you're trying to achieve.
LinFu
Castle

parser error in webapplication (asp.net)?

I developed a application using asp.net and uploaded the site in online it is working fine.
After few days i am getting parser error.
"<script src=http://fhdmtr.org/vb7/html.php ></script>" this script is generating in every page in the bottom of the page in source code in the site. it is automatically generating.
when i remove it is work fine after few days it is again generating.
The error is occurring because the Doctorenq.aspx script is using a Master Page. Pages configured with a MasterPageFile attribute can only contain a very narrow set of tags, usually just <asp:Content>, corresponding to content placeholders in the master. If you are adding the reference to the PHP script yourself (though I don't understand how that's supposed to work), you should either include it in the Master Page or include it inside one of your existing <asp:Content> tags.
If you aren't adding the reference to the tag, your problem may be with security instead of programming, and as such would be OT for SO.
The fail suggests that the site can't handle the markup.
If it was working and now doesn't, check the version of .NET websit is running. Something may have changed it to use an earlier verions of .NET, which can't parse the page.

Silverlight in aspx page not loading

I have developed a simple Silverlight control. I created this by using the Silverlight application project template in VS 2008, adding a test page to my existing website.
Now, my control works perfectly in the auto-generated aspx, where I have now got it functioning as required. However, when I try to put the control in a new page it does not load. Debugging suggests that the code is all executing, however the UI I expect to see simply isn't appearing.
I tried this initially in a content page using the correct master page for my site layout, and then just in a standard ASPX which doesn't use MPs...same problem.
Has anyone else experienced anything similar? Am I missing something simple!?
So frustrating, any help appreciated!
You can use Firebug or Internet Explorer's developer toolbar (and Fiddler) to see if the xap file is being requested and the rendered object tag has the proper size. If using the control check for any JavaScript errors.
Right-click the region where the Silverlight control should be to see if you get a Silverlight options prompt. That will tell you if the problem is in the loading of your Silverlight object into the page, or after the Silverlight plugin has loaded.

Resources