Relative url in Visual web part - sharepoint-2010

In my Visual web part I'm using relative url like following and it's working fine . But I assume it will not work when I deploy my project in different site structure on another server. So my question is how to make links,urls dynamic which will work in all the scenarios.
../../something.aspx
Please note I have some JQuery files included in <script> tag I can't only rely on building dynamic url using code.

Rishi,
Are you using a document library to store the page? If so, you could use SPDocumentLibrary.DefaultViewURL. If you're trying to navigate to a different web, then you can get a web's URL from SPWeb.Url.
Best,
-Tony

Related

SSRS URL Change

I am struggling with getting SSRS to have a domain name without naming the virtual directory. To give an example.
I currently have reporting.domain.com/reports working fine. It's great. However, I want to eliminate the /reports, and I want to use reports.domain.com.
I have tried to google this, but I haven't found any instructions on getting this done.
Does anyone have any idea what I can do? This is for INTERNAL purposes and not public web purposes.
Reiteration:
reporting.domain.com/reports (currently works fine)
to
reports.domain.com (I want end users to use this)
You can enable IIS on the SSRS box and have it forward http://reports.domain.com to https://reports.domain.com/reports.
See eg https://www.sqlservice.se/how-to-redirect-ssrs-url/
This is possible, the above answer was close but just off base.
Install IIS Services.
Create a website with the name you want.
Create a page called Default.htm and make it a HTML document. Input the HTML meta code to redirect to another website.
Create a DNS record for your website, and it should work.
Using an HTTP Redirect built into IIS will not work with the SSRS stuff, must use the HTML meta code.
<meta http-equiv="refresh" content="delay_time; URL=new_website_url" />

Blazor read directory

How do you read a content directory into Blazor.
I tried
Path.Combine(Directory.GetCurrentDirectory(), "..", "_posts");
But this throws an error.
Uncaught (in promise) Error: System.IO.DirectoryNotFoundException: Could not find a part of the path '/_posts'.
The answer depends on why you want to read the directory
If you want to interact with the user's file system, then you need to use the HTML standard for accessing the file system. A blazor wrapper is provided at https://github.com/Tewr/BlazorFileReader
If you want to retrieve files from your server, there are multiple approaches based on how you want to use it. You could set up an api, an mvc instance, or just serve static files. They'll all be relative to your server though, not the current directory.
If you want store data client-side, Flores made a good suggestion to use https://github.com/BlazorExtensions/Storage
Clientside Blazor is running in the same sandbox that javascript is running in. Which means your code has no way of accessing the local filesystem.
Maybe localStorage could be an alternative for you? There is a Blazor package to use it here: BlazorExtensions/Storage

Links in Express app missing API Gateway stage with Claudia JS

I've deployed a very basic Express app through Claudia JS. It's working pretty well, but any links or redirects don't keep the API Gateway stage and so don't work.
For example I have the app deployed at http://example.execute-api.eu-west-2.amazonaws.com/production - that's the equivalent of http://localhost:3000 when running locally. If there is a link on that page along the lines of <a href="/test"> that goes to http://localhost:3000/test locally, but through the api gateway it goes to http://example.execute-api.eu-west-2.amazonaws.com/test - losing the /production part of the URL and therefore not working.
Is there a way to get Express to know that all routes need to be prefaced with /production?
The alternate solution is to use a custom domain, but that seems like a lot of hassle to solve what seems like it should be just a bit of config.
You can use something like this to build the base URL;
https://${req.apiGateway.event.headers.Host}/${req.apiGateway.event.requestContext.stage}

Aurelia with out a router, navigate to login.html and not /#login

I'm writing custom views for Identity Server 3 for its login, logout, consent, etc. I want to use Aurelia but in Identity server I have to pass in the actual html file. So, how can I navigate to localhost:9000/login.html and not localhost:9000/#login
Thanks
if you want to remove the # from URLs in an aurelia application:
Configuring PushState
Remember that Aurelia is "just JavaScript," so when you want to link to another page on your site, you'll do it the same way you always would, by giving either an absolute or relative path to the file. You're not going to be able to link to an HTML file that is in your bundle though, the file will have to be unbundled, like index.html is.
At this point, this becomes just a standard JavaScript question about building a URL, and not anything to do with Aurelia. So just have the url point to wherever login.html is. I'm hoping this is enough for the answer, if not we can discuss it further.
With #Ashley Grant's help, I was able to create an aurelia replacement for IViewService example coded in angular. Identity Server 3 IView Service Example
It's honestly quite easy. Just create a standard aurelia project and put your html in app.html and view model in app.js. In addition to having the vendor_bundle reference link in your Index.html you will also have to create a link for the app_bundle as well because of a bug that tries to locate app_bundle in the root of your folder structure for Identity Server.
If anyone is interested in the source I can put something together just IM me.

Sharepoint Web template

I have created a web template solution by following Vesa "vesku" Juvonen 's blog(http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx).
I have the web template and have created sub sites with it. Now I need to create a web template from this template, which would consist of lists and other items.
The publishing feature does not have the save as template option, So I get into the _layouts/savetmpl.aspx to create one or deactivate the publishing feature to create getthe "save as site template option and create one. It creates but does not work properly.
I access the site by appending the default.aspx to the newly created sites url and it does not have any features as that of root template. Is there any way to create a template from the existing web template to work correctly. I am a newbie to sharepoint and vesku's blog has been my reference.
Any options or views to do it correctly would be helpful.
I have thought about creating a site through code and given the user an option to do so by including a web part where he could click on say "create a webs site with XXX template and include XXX lists, web parts etc. Is it a good approach?
If the web site that you created a template for contains web parts that access the GAC (i.e. have DLL's), then you must take the wsp that is in the solution gallery and deploy it as a farm solution.
Templates saved via /_layouts/savetmpl.aspx cannot access the GAC.
if you made a webtemplate why would you want to use the save as site template option? Users can also create sites from your webtemplate and if you need a different template you just add another webtemplate.
The whole principal of web templates is meant to be used for site creation....