Accessing BSP application through URL - sap-bsp

I have created a bsp application. For accessing this application i am facing problems. And regarding URL i have some doubt.
Doubt 1:- http://xyz.abc.com:8000/sap(bD1lbiZjPTAwMQ==)/bc/bsp/ns/mt_mwm/issuesto.html
in this url what is (bD1lbiZjPTAwMQ==) this.
Problem: wnen i am maving TP development to quality this code ( (bD1lbiZjPTAwMQ==) ) got changed. and from quality to production again got changed.my queastion how to make it dynamic. from where i can get it.??
I am following this link https://help.sap.com/saphelp_nw70ehp1/helpdata/en/ca/f8b53a364e0e5fe10000000a11405a/content.htm

What you see is added by the SAP server for session handling! You don't have to worry about it, it will be added automatically. If you want to bookmark a link to your app then just remove this (bD1lbiZjPTAwMQ==). Also, never use this hard coded in your code! For more information see this.

If you want a static link, use this notation: http://xyz.abc.com:8000/sap(====)/bc/bsp/ns/mt_mwm/issuesto.html

Related

ASP.NET Core 5 MVC web app returning bad request errors in some pages after deployment to IIS

I have tried everything. I configured Windows Server 2019 according to Microsoft documentation and I successfully deployed a .NET 5 web application to the IIS.
I can get to the login page. I can even get to the forgot password page and they show themselves fine. However when I try to do any action (send the forgot password link or login to the page) I get a "Bad Request" from the server. I haven't found a way to explain why.
I have tried several, and I mean several things found Googling around but nothing helps. This include disabling https within the .NET Core application, trying to get a detailed error page using the app.UseDeveloperExceptionPage(); instruction inside Startup, etc etc but nothing works. I always receive this page trying to execute any action:
If someone could help or point me into the right direction, I will really, REALLY appreciate it.
Thank you
PD: In case it has anything to do with the problem, the error, at least the two that I can reproduce (because I can't even log in), happens, I think (maybe don't) when redirecting to another page in Microsoft Identity.
EDIT: code was asked by one of you. Thank you.
As you see, there's nothing specific in the forgot password screen for my application. This is scaffold code from Microsoft Identity. I even edited it and just let one line of code inside it, which is the default return code anyway as follow:
public async Task<IActionResult> OnPostAsync()
{
return RedirectToPage("./ForgotPasswordConfirmation");
}
As you can see, there's nothing special with that code. Here's the html that calls it, again, is a scaffold of Microsoft Identity with little to no changes (by little, I mean, maybe some CSS and a new value of view data):
But then again, forgot password page actually shows and seems well in the front end, but immediately I try to enter my email and click enter in this page, (also, just a scaffold of Microsoft Identity):
Nothing happens. I receive the bad request. There's NO magic nor custom code here. Something silly is going on.
EDIT II: YES, locally it works perfectly. The strange behavior happens only when deployed to IIS.
EDIT III: I coded and enabled logging in my .NET Core APP and wrote that to a file, and I think I finally got, at least the error (not the reason yet):
But why?? Cookies are enabled in the server browser without avail, same issue. Someone has a better idea than disabling anti forgery rules to login and forgot password pages?
Thank you
For some reason, when I deployed the first version of my app into IIS, I thought it was a good idea to just browse it from the IIS link. Of course, in a new mounted Windows Server 2019, IE is still the default browser. I connected directly to the IP of my web app via VPN, but used Chrome this time. Guess what? All problems disappeared. Yes, it's a bad idea to try to use a modern framework like .NET Core Identity with IE.

Kentico: PortalTemplate.aspx explicitly throwing a 404 error when directly invoked

We work on a product that is a series of components that could be installed on different CMSs and provide different services. We take a CMS agnostic approach and try to use the same code in all the CMSs as much as possible (we try to avoid using CMS API as much as we can).
Some part of the code needs to work with the current URL for some redirections so we use Request.Url.ToString() that is something that has worked fine in other environments but in Kentico instead of returning the current page we always get a reference to CMSPages/PortalTemplate.aspx with a querystring parameter aliasPath that holds the real URL. In addition to that, requesting the Template page using a browser gives you a 404 error.
Example:
Real URL (this works fine on a browser):
(1) https://www.customer.com/Membership/Questionnaire?Id=7207f9f9-7354-df11-88d9-005056837252
Request.Url.ToString() (this gives you a 404 error on a browser):
(2) https://www.customer.com/CMSPages/PortalTemplate.aspx?Id=7207f9f9-7354-df11-88d9-005056837252&aliaspath=/Membership/Questionnaire
I've noticed that the 404 error is thrown explicitly by the template code when invoked directly. Please see below code from Page_Init method of PortalTemplate.aspx.cs:
var resolvedTemplatePage = URLHelper.ResolveUrl(URLHelper.PortalTemplatePage);
if (RequestContext.RawURL.StartsWithCSafe(resolvedTemplatePage, true))
{
// Deny direct access to this page
RequestHelper.Respond404();
}
base.OnInit(e);
So, if I comment the above code out my redirection works fine ((2) resolves to (1)). I know it is not an elegant solution but since I cannot / don't want to use Kentico API is the only workaround I could find.
Note that I know that using Kentico API will solve the issue since I'm sure I will find an API method that will return the actual page. I'm trying to avoid that as much as possible.
Questions: Am I breaking something? Is there a better way of achieving what I trying to accomplish? Can you think on any good reason I shouldn't do what I'm doing (security, usability, etc)?
This is kind of a very broad question so I was not able to find any useful information on Kentico docs.
I'm testing all this on Kentico v8.2.50 which is the version one of my customers currently have.
Thanks in advance.
It's not really recommended to edit the source files of Kentico, as you may start to run into issues with future upgrades and also start to see some unexpected behaviour.
If you want to get the original URL sent to the server before Kentico's routing has done its work, you can use Page.Request.RawUrl. Using your above example, RawUrl would return a value of /Membership/Questionnaire?Id=7207f9f9-7354-df11-88d9-005056837252, whereas Url will return a Uri with a value of https://www.customer.com/CMSPages/PortalTemplate.aspx?Id=7207f9f9-7354-df11-88d9-005056837252&aliaspath=/Membership/Questionnaire (as you stated).
This should avoid needing to use the Kentico API and also avoid having to change a file that pretty much every request goes through when using the portal engine.
If you need to get the full URL to redirect to, you can use something like this:
var redirectUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.RawUrl;

THREDDS Server NetCDF file via WMS

I have setup TomCat and THREDDS server (loaded war file) and attempted to serve up some *.nc files using via WMS protocol.
I can request the file but all I seem to get back is a black image.
I had something similar in geoserver but I was able to update the styles layer and setup ranges so that various colours were applied.
I have tried editing the 'wmsConfig.xml'and alter options such as the 'defaultColorScaleRange' but it doesn't seem to have the desired effect.
I have read the documentation a few times but I may be missing something , has anyone overcome this problem ? Any help would be great.
Cheers
Update 1
So as suggest below using the built in viewer I can see the image and this is what I would like to get by requesting via WMS.
Using built in viewer
address : http://10.19.38.63:8080/thredds/godiva2/godiva2.html?server=http://10.19.38.63:8080/thredds/wms/testAll/testData.nc#
Requesting initial attempt
http://10.19.38.63:8080/thredds/wms/testAll/testData.nc?service=WMS&version=1.3.0&request=GetMap&CRS=EPSG:4326&width=150&height=150&bbox=-10097025.688358642,-12875664.540581377,20037508.342789244,313086.06785608194&LAYERS=precipitation&format=image/png&STYLES=boxfill/red
Which returns just the black square :(
I will carry on and look at the WMS url used by th eopenlayers example, maybe thats the key... ill continue to update my questions as my journey begins :).
Update 2
Managed to work out that the SRS being passed in was incorrect and needed altering.
now next stage is to work out how to request a time series over a batch of NCDF files.....
Update 3
Managed to work out a way to automate requesting WMS services and with the aid of this great plugin for leaflet maps I have the desired output.
https://github.com/socib/Leaflet.TimeDimension
Basically call the WMS endpoint with getmap that I require building up the url relevant for the file I need to request.
The next step for me is looking at styled for the returned raster at this point seems like some Java code modification, but at least my initial problems have gone. phew!
Update 4
Gone away and tried to rebuild the Java on a project ncWMS which I found was standalone but now incorporated into THREDDS. Still having no joy with transparency raster created from NETCDF.
Looking at THREDDS code a bit more after I also tried changing palletes that didnt seem to work , issue raised
https://github.com/Unidata/thredds/issues/631
You haven't shared the full url of your THREDDS request, but 10.19.38.63/thredds/wms/.... is the service url for the WMS GetCapabilities file. Which is an XML file describing the WMS service. That is not the THREDDS url for viewing the WMS via ncWMS. You need to scroll down the page to the Viewers: section and choose the Godiva2 (browser-based) link.

Accept QueryString for Image delivered by Controller

I'm trying to make a controller that delivers a random background image. I have a MVC route from /random-background.jpg to /MyController/RandomBackground, and it's returns File(backgroundImage, "image/jpeg"). This is working fine.
I've disabled the 404 plugin for all QueryStrings that ends with random-image, so the image is showing up. However, it won't take any parameters, such as random-background.jpg?width=200. &format=jpg doesn't have any effect either.
How do I get ImageResizer to accept this for a "real image"? Do I have to use ImageResizer.ImageJob? If so, I would love an example I can understand :)
ImageResizer V3 and earlier cannot 'post-process' the result of an MVC action or third-party HTTPHandler.
You will need to use one of the virtual providers plugins, use URL rewriting, or implement your own IVirtualImageProvider.
See the best practices guide for an explanation of 'why'.

Automatically saving web pages requiring login/HTTPS

I'm trying to automate some datascraping from a website. However, because the user has to go through a login screen a wget cronjob won't work, and because I need to make an HTTPS request, a simple Perl script won't work either. I've tried looking at the "DejaClick" addon for Firefox to simply replay a series of browser events (logging into the website, navigating to where the interesting data is, downloading the page, etc.), but the addon's developers for some reason didn't include saving pages as a feature.
Is there any quick way of accomplishing what I'm trying to do here?
A while back I used mechanize wwwsearch.sourceforge.net/mechanize and found it very helpful. It supports urllib2 so it should also work with HTTPS requests as I read now. So my comment above could hopefully prove wrong.
You can record your action with IRobotSoft web scraper. See demo here: http://irobotsoft.com/help/
Then use saveFile(filename, TargetPage) function to save the target page.

Resources