• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 930
  • Last Modified:

SP2010: Redirect problem

Hello. I created simple redirect functionality, but it does not work correctly:

JavasScript based redirect works correctly, but SPUtility.Redirect(ResirectUrl, SPRedirectFlags.UseSource | SPRedirectFlags.Trusted, System.Web.HttpContext.Current);  or Response.Redirect gives me an access denied error. Whats wrong with my code?
0
tolppa
Asked:
tolppa
  • 4
  • 2
1 Solution
 
Rainer JeschorCommented:
Hi,
where / how have you implemented the redirect?
Could you track the requests e.g. using fiddler?
Which SharePoint edition (Foundation / Server / Office 365)?
Thanks.
Rainer
0
 
tolppaAuthor Commented:
Hello. Basically I have a Foundation / Visual WebPart with some logic  and redirect functionality.  I have to test with fiddler if I have time, but I am relatively content with javascript based functionality.
0
 
Rainer JeschorCommented:
Hi,
question:
What is the source url?
And what is the redirect url?
Please note both urls completely including protocol/url/port/query string parameters.
You may annonymize the urls but the redirect depends on the flags as well as the urls.
I want to reproduce your behavior.

Thanks.
KR
Rainer
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
tolppaAuthor Commented:
I wish to redict http://XXX/XXX/XXXX/SitePages/Home.aspx 

This or response redirect does not work:
SPUtility.Redirect("http://XXX/XXX/XXXX/SitePages/Home.aspx ", SPRedirectFlags.Default, HttpContext.Current);

Error url seems to be your standard access denied page: http://XXXX/XXX/_layouts/AccessDenied.aspx?Source=http%3X%2X%2XXXXX%2XXXXXX%2Fdefault%2Easpx

JavaScript redict users correctly to: http://XXX/XXX/XXXX/SitePages/Home.aspx .
0
 
tolppaAuthor Commented:
I used standard javascript to do the redict.
0
 
tolppaAuthor Commented:
Not perfect solution, but it works.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now