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?
LVL 1
tolppaAsked:
Who is Participating?
 
tolppaAuthor Commented:
I used standard javascript to do the redict.
0
 
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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:
Not perfect solution, but it works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.