WCF Url Rewriting using global.asax
Hello,
I am doing Url Rewriting using global.asax but getting below error message.
Description: HTTP
404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Services/MyService.svc/rest/CheckInternet
I tested service. its working fine without url rewriting.
please help me to solve this issue.
Please "Mark as Answer" if this post answered your question. :)
Kalpesh Chhatrala | Software Developer | Rajkot | India
Kalpesh 's Blog
VFP Form to C#, Vb.Net Conversion Utility
Hi Kalpesh Chhatrala,
I wonder if you are using the WCF Soap Service or the WCF Rest Service.
Since your WCF Service works very well without the URI Rewriting, then it seems that you have do something wrong during the process of the URI Rewriting, so please try to refer to the following articles about how to do the URI Rewriting
for the WCF Service:
http://blogashwani.blogspot.com/2013/02/url-rewriting-for-wcf-service.html .
http://blogs.msmvps.com/abu/2008/12/22/url-rewriting/ .
http://blogs.msdn.com/b/endpoint/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx .
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
We are trying to use URL rewriting using JSTL. We have some problems facing URL
rewriting. The issues we have are
(1) We use absolute URLs
(2)Some times we have situations based on certain input field validations
we use
javascript to perform URL rewriting based on the input by the user.
Have anyone done URL rewriting using JSTL (absolute URL versus relative URLS)
Regds
Guna
Hi
Kalpesh Chhatrala,
If this issue still not resolved, please consider to post in WCF forum.
Here is the link
https://social.msdn.microsoft.com/Forums/en-US/home?forum=wcf
Now i will move your thread to Off-topic forum. If you have any other issues about C#, please feel free to post in this forum. Thanks for your understanding.
Thanks
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Cannot connect azure file using IIS global.asax
We have been using Azure File with IIS 7.5. We use, in global.asax, a script that mounts azure file to a specific drive allowing our aspx application working with smb files.
It happens sometimes, when VM restarts, that mount operation fails showing the following error
[Exception: WNetAddConnection2 failed with error 1312]
MountShare.Mount(String shareName, String driveLetterAndColon, String username, String password) in e:\Siti\Condomini\CReport\App_Code\MountShare.cs:53
ASP.global_asax.Application_Start(Object sender, EventArgs e) in e:\Siti\Condomini\CReport\Global.asax:14
Global.asax contains these lines of code
void Application_Start(object sender, EventArgs e)
String AzureUrl = ConfigurationManager.AppSettings["AzureUrl"];
String AzureUser = ConfigurationManager.AppSettings["AzureUser"];
String AzurePassword = ConfigurationManager.AppSettings["AzurePassword"];
String AzureLocalLetterDrive = ConfigurationManager.AppSettings["AzureLocalLetterDrive"];
if (!string.IsNullOrWhiteSpace(AzureUrl) && !string.IsNullOrWhiteSpace(AzureUser) && !string.IsNullOrWhiteSpace(AzurePassword) && !string.IsNullOrWhiteSpace(AzureLocalLetterDrive))
MountShare.Mount(AzureUrl, AzureLocalLetterDrive, AzureUser, AzurePassword);
How can i fix these error that happens randomly after VM restarts ?
Thanks
FrancescoHi Francesco,
You can create a persistent connection to an Azure File share so that after a VM reboots, the share will be available for your scheduled tasks, applications, or logged in user.
You could refer the following link for details on how to persist connection on IaaS VMs and Windows PaaS roles.
http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/27/persisting-connections-to-microsoft-azure-files.aspx
Also error 1312 means 'A specified logon session does not exist. It may already have been terminated.', You might consider the code available in the blog to persist connections.
Regards,
Malar. -
Always use URL Rewriting for session tracking?
All you JSP guru:
I am working on a JSP project that requires session tracking. I have successfully implements session tracking with both cookies or URL rewriting. I know that with the HttpSession object, it will always try to use cookie first, if that's disabled, then it'll automatically switch to URL rewriting. However, is there a way to force the HttpSession object to ALWAYS use URL rewriting instead of cookies? I have searched for an answer for a long time and haven't been able to found a solution. Is it possible at all? Thank you very much.i was going to say that WebSphere always uses URL rewriting if you enable it at all, but someone beat me to it (indirectly) :-)
however, that seemed to me to be a violation of the spec, which seemed to imply the behaviour you're describing (only use URL rewriting if cookies are not supported on the current client)
here's a response someone else made on a websphere newsgroup to a statement in that regard:
I believe you are technically correct. However from my
experience, I think the spec if flawed in this area since
there is no reliable way of determining whether the
client browser supports cookies. The authority on
cookies (www.cookiecentral.com) says:
"To properly detect if a cookie is being accepted via
the server, the cookie needs to be set on one HTTP
request and read back in another. This cannot be
accomplished within 1 request."
This is asking too much of a servlet engine
implementation. Even if it did submit a request for this
purpose, the user could refuse the cookie. So
then technically the browser supports cookies, but the
servlet engine infers it doesn't. So if the servlet engine
infers the browser does not support cookies and so
encodes the URL, it is again out of spec because the
browser really does support cookies. By doing it
however encoding is configured makes things simpler,
robust, consistent and avoids the flaw.
My opinion.so, mostly i'm just rambling, but if you're using websphere, you should get the behaviour your boss wants. if you're using something else, i suppose there's a chance it'll "violate" the spec in this same, potentially helpful way.
btw, i remember somebody else complaining that URL rewriting is less secure than cookies, but i kinda think they're about equal. it seems like either could be intercepted by a sniffer and then used to spoof. but i'm no expert in that stuff... -
Using Tomcat URL rewrite valve
http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
Looks like the latest version of Tomcat has added support for URL rewriting similar to Apache mod_rewrite
I can't seem to find any documentation other than the page above.
Has anyone used this to, for example, rewrite APEX URLs from http://host:port/apex/... to http://host:port/pls/apex ? Where should we put the RewriteCond and RewriteRule directives?
ThanksI just went though this, spent about two days trying to figure out how to do with only tomcat and gave up. I found and used urlrewrite.. The instructions are right on main page but are vague. I've given "hints" below. My info assumes you renamed ords.war to apex.war. I tried to post full details of my exploits/trials/troubles using the Oracle blog but it errored out.
http://tuckey.org/urlrewrite/
Step 1 say to place the file in WEB-INF/lib. For Tomcat, WEB-INF is the Tomcat application directory, mine was /opt/apache-tomcat-7.0.56. Place in the <tomcat_app_dir>/lib directory.
Step 2 says to edit the web.xml file, adding the config text for urlrewrite. This file is located in <tomcat_app_dir>/ROOT/WEB-INF Copy text and paste just above the </web-app> tag at the bottom of the <tomcat_app_dir>/ROOT/WEB-INF/web.xml file.
Step 3 talks about editing urlrewite.xml file, which doesn't exist. You must create this file, in the same directory, <tomcat_app_dir>/ROOT/WEB-INF. The following is the contents of mine.
<urlrewrite use-query-string="true">
<note>
rewrite from /pls/apex to pls
</note>
<rule>
<from>/pls/apex/f\?p(.*)</from>
<to type="redirect">/apex/f?p$1</to>
</rule>
</urlrewrite>
You can check that urlrewite is working by accessing the admin/test page from the localhost....<servername>:8080/rewrite-status. The page shows you the rule and what it thinks it's going to do.
You now need to restart Tomcat and your old URL <servername>/pls/apex should work for your users who have bookmarked your old apex apps. It works for the new URL as well: <servername>/apex
I noticed you are also referencing port numbers in your sample url. Take a look at this blog post below, specifically step 6 and 7 to learn how to redirect to 80, so you don't have to use a port.
Install Tomcat 7 on CentOS, RHEL, or Fedora : David Ghedini -
If user disable cookie how to set and use session with URL Rewritting
if user disable cookie how to set and use session with URL Rewritting by append session ID in url
If cookies are disabled, then app server will automatically try to use URL rewriting for session control. Programmer's responsibility is to encode any links or redirects using
response.encodeURL("/yourPage.jsp")
and
response.encodeRedirectURL("/yourPage.jsp")
See API for details
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)) -
Unable of keep session using url rewriting tomcat
Hi everybody,
I have an application which communicates with a servlet. I am trying to use session tracking for my midp application with the url rewriting technique because of simplicity. I have tomcat 4.0.3 and MIDP 2.0. I had forced the use of url rewriting including this line into the server.xml file from tomcat:
<Context path="/webappname" debug="0" cookies="false" docBase="webappname"/>
This should force url rewriting, but when i call the method encodeURL in my servlet i only get a void
string. I know this isnt the best forum for this, but i have to try ;-). Any suggestion? all comments will be wellcomed, but please i dont want to use cookies and the rms api.
Thanks.Are you aware that the MIDlet's networking won't support cookies or redirections automatically, and that you have to code that yourself: reading the "set-cookie" header and saving it for later, or catching redirection response codes (3xx) and changing the url accordingly?
Check out these tutorials:
http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-wireless.html
http://developers.sun.com/techtopics/mobility/midp/articles/servlets/
shmoove -
Using URL Rewrite for HNSC Web App
Greetz!
I'm using host named site collections in my deployment of 2013 Enterprise. I've got a single web app, on the default zone, that was created on port 443 with the -SecureSocketLayer parameter. How can I seamlessly redirect users accessing a HNSC with http
to the correct (and only) https url? I'm using the URL Rewrite 2.0 with IIS 8.5.
I have the following rule in place but it is still throwing a 404 on pages. Is this able to work with Host Named Site Collections and does it matter that I've installed the Web App on 443 without having it on 80 first? It shouldn't but SharePoint has
surprised me before ;):
<rule name="SSL Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{SERVER_NAME}" redirectType="Found" />
</rule>
<rule name="HTTP/S to HTTPS Redirect" enabled="false" stopProcessing="true">
<match url="(.*)" negate="true" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT_SECURE}" pattern="1" />
<add input="{SERVER_PORT_SECURE}" pattern="0" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}" redirectType="Permanent" />
</rule>
Love them all...regardless. - Buddhaare you using the URL Rewrite on the same IIS web application as the SharePoint sites?
Scott Brickey
MCTS, MCPD, MCITP
www.sbrickey.com
Strategic Data Systems - for all your SharePoint needs -
ColdFusion with IIS URL Rewrite - Page never finishes loading
I am running CF10 on IIS 7.5 with URL Rewrite module installed.
All the rewrite rules work perfectly and ColdFusion is returning the correct pages. In order to get the page displayed in the browser I have to manually set the 'content-length' value in Application.cfc like this:
<cfcomponent>
<cffunction name="onRequestEnd">
<cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#" />
</cffunction>
</cfcomponent>
Without this code the browser does not display the page. However, even though it is now displaying the page, it is not doing it correctly. The page never finishes loading fully and not all of the HTML content seems to be on the page.
I have tried to add a <cfflush> tag after setting the 'content-length' but it makes no difference. I don't understand why this is happening but I know that it has happened to someone else who was using htaccess: http://forums.devshed.com/coldfusion-development-84/page-not-finishing-loading-coldfusion- and-htaccess-bug-575906.html
Can anyone please help?Hi guys,
I would like to do url rewriting on our CF app but am worried I'll break something if I try and do it myself - is there anyone who would be interested in a bit of consultancy to help us achieve this?
I want to turn http://www.allchichesterjobs.com/search-results.cfm?sector=21&q=part-time-jobs
into http://www.allchichesterjobs.com/part-time-jobs
I've tried this using IIS and URL Rewrite, when I browsed to http://www.allchichesterjobs.com/search-results.cfm?sector=21&q=part-time-jobs
my browser was redirected to http://www.allchichesterjobs.com/part-time-jobs ok - but then I got a 404 error
I'm wondering if I can pay someone to remote view my screen while we talk on skype and tell me what to do?
Hope it's ok to post this sort of request on here
Thanks very much indeed.
Nick -
IIS Reverse Proxy with URL rewrite.
Hi all, hoping to leverage the wealth of knowledge contained here.
Any assistance would be very welcome.
I'm having an issue getting a reverse proxy and URL rewrite working in IIS 7.0.
I need to redirect all requests with a specific virtual directory suffix only.
ie; https://domain.test.com/outbound/Content/query_etc
With /Outbound/ being the trigger.
This should be redirected to http://10.10.10.10/inbound/Content/query_etc
While at the same time, requests without the /outbound/ suffix should be handled locally.
I have configured the reverse proxy as described in a few articles, and have had no luck.
Here's a snippet from my (sanitized) web.config at the site level.
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A" pattern="^http(s)?://10.10.10.10/inbound/(.*)" />
<action type="Rewrite" value="https://domain.test.com/outbound/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="^outbound/(.*)" />
<action type="Rewrite" url="http://10.10.10.10/inbound/{R:1}" appendQueryString="true" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
To me, this looks correct, yet it doesn't work.
With this, I get the normal 404 - Error Code 0x80070002, with the text indicating the local directory doesn't exist, so.... not being picked up by the filter for redirection.Hi Andrew,
Looking at your requirements it appears you need Reverse Proxy To Another Site/Server.
By using URL Rewrite Module together with
Application Request Routing module you can have IIS 7 act as a
reverse proxy.
It seems like URL Rewrite can't re-route the request somewhere else out of the server.
Even when you rewrite the url the actual connection remains with the server. Hence if your original server doesn't have /inbound/Content/query_etc it will fail with 404.
Hosting multiple domain names under a single account using URL Rewrite.
It’s a common desire to have a single IIS website that handles multiple sites with different domain names.
References:
How to create a url alias using IIS URL Rewrite:
http://blogs.technet.com/b/mspfe/archive/2013/11/27/how-to-create-a-url-alias-using-iis-url-rewrite.aspx
Reverse Proxy with URL Rewrite v2 and Application Request Routing:
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing
Regards,
Satyajit
Please“Vote As Helpful”
if you find my contribution useful or “MarkAs Answer” if it does answer your question. That will encourage me - and others - to take time out to help you. -
URL Rewrite Rule: HTTP to HTTPS Not Working
Here is my problem. I cannot get HTTP to HTTPS redirect to work using the URL Rewrite module. I am using version 2, by the way, which I understand is the latest version. I've also enabled the "Proxy Server" and Application Request Routing"
features.
I've trolled through the Internet for 2 days now for solutions to my problem, including the ones provided by the TechNet forums and by MVP Scott Forsyth. I've tried over 30 solutions, and none have resolved my issue. Granted some of the solutions I've tried
may have been repeats of others. After trying so many, I have had a hard time discerning the differences. Does it really matter, for instance if the pattern match for the {HTTPS} input is specified as
"^off$" or just "off"? I see this discrepancy (among others) everywhere. It seems like there are so many variations out there. It is quite confusing for the uninitiated and the newbies like myself to the
URL Rewrite technology. I have enabled and consulted my "Failed Request Tracing Rules" logs but cannot make any sense of the cryptic information it is providing.
I just cannot get my reverse proxy server to redirect http requests from the Internet to https to my internal web server. When a user specifies "https://server1.xxxxx.com". he is able to access the internal server via the reverse proxy (IIS) server.
But when he specifies "http://server1.xxxxx.com" he receives "Server Error 500 - Internal server error.There is a problem with the resource you are looking for, and it cannot be displayed."
At this point I am at my wits end, and am even considering configuring the protocol translation on our firewall. But this not my preference as it presents another layer of complexity, and device to troubleshoot later on. Below I've pasted my entire web.config
file with my most current version of the rule in question (in bold) for your review. I started to paste just the specific rule, but thought you might need to see the entire file in case something else may be conflicting with the rule.
Thank you in advance for your help.
Dave Robinson
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="HTTP to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{REQUEST_URI}" redirectType="Found" />
</rule>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<serverVariables>
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
<action type="Rewrite" url="{C:1}://server1.xxxxx.com/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
<match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
<action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
</rule>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^http(s)?://server1.xxxxx.com/(.*)" />
<action type="Rewrite" value="http{R:1}://server1.xxxxx.local/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
<preCondition name="NeedsRestoringAcceptEncoding">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket"
verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="404" />
</add>
</traceFailedRequests>
</tracing>
<httpErrors errorMode="Custom" />
<httpRedirect enabled="false" destination="" exactDestination="false" childOnly="false" httpResponseStatus="Permanent" />
</system.webServer>
</configuration>On Wed, 28 Jan 2015 17:53:41 +0000, dwrobins2000 wrote:
Here is my problem. I cannot get HTTP to HTTPS redirect to work using the URL Rewrite module. I am using version 2, by the way, which I understand is the latest version. I've also enabled the "Proxy Server" and Application Request Routing"
features.
Web/IIS related issues are better posted where the IIS experts are:
http://forums.iis.net
Paul Adare - FIM CM MVP
"The equivalent of treating dandruff by decapitation"
-- Frank Zappa on the Parents Music Resource Center' censorship plans -
URL rewriting for a WebService Consumer Proxy
Hi all,
Did anybody come across this issue?
I have a SAP System - let's call it "TM" - that I want to bind with another non-SAP one - let's call it "FB" - without any PI between them.
The communication is made as a Service Consumer (TM side), the Proxy (see image below) and Proxy-Implementation Class being generated automatically after the ".wsdl" file and the "url" given by the documentation of FB.
Everything looks good! All the Methods (operations) that are available from the service have been added to the Implementing Class.
After the Proxy generation, I also created the Logical Port (in transaction SOAMANAGER - see image below) where the path, host, prefix, and all the necessary stuff were also automatically created after the ".wsdl" document.
So far so good! When I want to test it and to play along with this connection TM -> FB, I am creating the Proxy-Object, I am filling the required User / Pass / and an ID in order to call the first method. As you have probably guessed already: LOGIN.
ls_in_login-login_request-id = '...some ID...'.
ls_in_login-login_request-user = '...some user ...'.
ls_in_login-login_request-password = '...some password'.
TRY.
CREATE OBJECT lo_proxy
EXPORTING
logical_port_name = 'ZAS_PORT_FB'.
CATCH cx_ai_system_fault INTO lo_ref. " Application Integration: Technischer Fehler
ENDTRY.
TRY.
CALL METHOD lo_proxy->login
EXPORTING
input = ls_in_login
IMPORTING
output = ls_out_login.
CATCH cx_ai_system_fault INTO lo_ref. " Application Integration: Technischer Fehler
CATCH cx_ai_application_fault INTO lo_ref. " Application Integration: Applikations Fehle
ENDTRY.
As a response, (meaning that the connection works and that the WebService acknowledges the connection) I get a "SessionID" -> a string of characters.
In the Wiki of the Service is written that from this point on, every other methods (but I mean ALL of them, logout() also...) need to be called along with this SessionID. The problem is, that this SessionID doesn't have a specific place in the "inbound"-structure of the methods, but this mechanism of passing around the SessionID must be made with URL rewriting. Another solution would be to use COOKIES. From my point of view, a so-called URL rewriting would be easier, right?
In the documentation is the following info written:
URL rewriting (recommended):
The JSessionId is attached to the URL of the SOAP request, as follows: http://[URL];jsessionid=[jsessionid]
Caused by tecnical reasons, it is necessary to specify the static string “;jsessionid=” in lower case letters.
I have turned this "LO_PROXY" object around and around and around... trying to find a solution... a method...anything that would let me rewrite the URL, but nothing...
I have also tried to use ce CL_HTTP_CLIENT class and to create myself the client and the URL and the host and everything manually... but in this case how do I end up in calling a specific "custom" method -> for instance... how do I call the "LOGIN"... or the LOGOUT...where do I put the parameters, etc?
Do you have any suggestions / ideas / hints ?
Thanks a lot in advance!
Warm regards,
AlexHi Stefan,
You are right! It doesn't support to set URL / HTTP parameters outside the logical port.
Nevertheless, I have debugged the whole engine and found out that via custom coding (enhancements / modifications) and with extreme attention, the URL can be rewritten as desired.
When a method of the proxy is called, let's say for instance: lo_proxy->logout (...) - as written up for example, the method CL_HTTP_CLIENT=>CREATE_BY_URL is called dynamically.
In this method, in the "url" variable is the desired URL that needed to be rewritten.
Here it's about an importing parameter, so it cannot be changed so easily, but it's not impossible.
Another place where a nice Enhancement can be created is at the beginning of the FM "SWLWP_URI_PARSE".
You need to be very careful not to change these places in all cases (this CREATE_BY_URL will be called pretty much), JUST when the specific conditions are fulfilled.
Have a great day / week!
Warm regards,
Alex -
URL-Rewriting or append query string in URL
Hi
I have one other quetion related to my project I am working and need to finish tonight.
I read one table in first JSP and want to send one column, eventname to the other JSP. Can I use URL-rewriting. I need to keep the event name thruoghout too.
Is this syntax correct..
Please help me !!!Syntax is:
<a href="ListEvents.jsp?event=eventname">Click me</a>In the JSP, there are two things you may need to do when generating the link.
1. Encode the URL - this is needed if any arguments (in this case "eventname") might include spaces or special characters.
2. Apply URL rewriting info if this may be needed. This will add "&JSESSIONID=xxxxx" if required.
<%
String link = "ListEvents.jsp?event=" + getEventName(); // or whatever gets the event name
link = java.util.URLEncode.encode(s,"UTF-8"); // encode the event name data
link = response.encodeURL(link); // add the session id if URL rewriting in use
%>
<a href="<%=link%>">Click Me</a>The event name is retrieved using request.getParameter("event") -
Hello all,
I am having a url rewriting issue where the first time someone accesses the website with a browser that has cookies enabled my jsp pages will still encode all of the URL's with the jsessionid. Which I believe should not happen unless cookies are disabled.
Why is this occuring?
Once the user goes to another page in the site or the second time they bring up the site in the same browser the jsessionid is not written to the URL links. This only happens on first access.
I am using Tomcat 5.5
response.encodeURL() to encode the links
Is this a container or programming error?
Thank you all very much for your time in reading this!Ok, thank you.
Based on this: http://www.sciabarra.com/fatwire/2011/04/17/improving-the-firstsiteii-url-assembler/
I think my approach would work if I remove the Asset API stuff from here and put them into a helper class, which would be then called from the wrapper JSP.
I'd rather not install 3rd-party extensions just for url rewriting, at least not yet... -
URL Rewriting in JSF 1.2
Hello,
I am new to JSF. I am using JSF 1.2. I basically need URL rewriting in my JSF pages.
I need to rewrite all Links in JSF by which jsessionid will attached to links in similar way to html:rewrite/html:link in struts .
How do i achieve this in JSF 1.2. I heard PrettyFaces does good job in this area but is there any other simple way to URL Rewriting in JSF?
Thanks in advance
SubbaraoJSF will do this automatically if it detects that the session cookie has not been set. (Really this is being done by the servlet infrastructure.) You need to make sure you are using JSF components to output all of the links, buttons, etc. If you need a link otherwise, use the methods on HttpServletResponse to encode the URL.
I think the configuration for declaring that your application should not use cookies is application server specific.
Maybe you are looking for
-
my music is all on my iphone. but now the music i downloaded years ago and no longer want is on there with a pic of a cloud? how do i get it off my phone?
-
Publishing of SAP DMS documents on local intranet
Hi all, I have a scenario in DMS where I have to publish documents from DMS on local intranet. How can I achieve this? The documents e.g. are like Environment policy, saftey manual , travel policy which has to be viewed by each person of a company w
-
Integration Directory not getting opened
hi All, We are not able to open Integration Directory in XI 7.0 but IR (repository) works fine. While i was browsing through the Forum found (Forum ID# 135222) that we can just re-start the sap.com/com.sap.xi.directory in Visual Administrator but not
-
Social media integration (fb,twitter...)
Hi All, How do we integrate the social media sites into e-commerce application ,I want share or like a Product in to social media,Could you please guide me how to do or any examples. Thanking you..! Regards, Jyothi.M
-
Trouble with Titles over Photos
I am having issues placing titles over the photos in my movie. I can create the titles and preview the title over the photo. When I click and drag the title icon to the timeline to place over the photo the title disappears. I have made sure that the