Hopefully someone knows a way to fix this issue, but here is my problem. I need to be able to recreate a md5 hash that will be the equivalent of the hash that php would generate.
The encoding I have tried is listed below. None of these will produce the same values.
MVC has a method LogOn in AccountControllers. It has parameter returnUrl to redirect after login. I used this method to redirect to login page and back to previous page after logined by returnUrl parameter.My code in form view
I want to remove "returnurl=/blabla" from address bar when a user want to access to a login required page. Because I'm trying to redirect the user to a static page after login to do some selections.
Is it possible clear ReturnUrl from the server? I have a login page where the user logouts and I want to direct them to a specific page but when ReturnURL is set it overrides my redirect page.
Update:Ideally, I will only redirect a user who has just logged out versus someone who has bookmarked OR I will redirect regardless in special cases.So these are the cases:A link or bookmark -> should redirect to specified page in most case.A logout that has a returnurl -> should NOT redirect to the page,A special case -> should always redirect to my special case, i.e when a user needs to see something important
Is there a way to remove the returnurl from the logout/login status control?
For a testproject I use two Login pages. I order to do that I use a dispatcher page:
Dispatcher:
[Code]....
I then just redirect in the dispatcher to the real login-page according to the ReturnUrl. So far so good. The only problem I have is that I don't get redirected to the ReturnUrl once I'm logged in... Of course I add the ReturnUrl to the forwarded Login-Page (/Admin/Login.aspx?ReturnUrl=...).
I'm building my asp.net 4.0 website with url routing. It works great, except that I have stumbled upon one problem. The problem is that when a logged in user is on one of the non-public pages and gets loged out, the return url is set to the page he or she was previously visiting. When logging in again, the ReturnUrl is non routed url (something like login.aspx?ReturnUrl=somethingsomething). This poses a problem for some of my pages where I have a default value stored in the route; it simply doesn't get picked up with the non routed url of the ReturnUrl.The result is a broken page (404).
There is an "Add to Cart" button on product detail page, and If I click the button, it should be directed to login page.
After I login, it should be re-directed to the product detail page.
"Add to Cart" button is a CartConroller action.
In CartController.cs :
[Code]....
In AccountController.cs :
[Code]....
the product should not be added into the cart before login, so I put [Authorize] on AddToCart action.
however if I click the "add to cart" button, it directs to the login page, and if I login, it gives me an error because it lost all the AddToCart action's parameter information(e.g. Cart cart, int productId, string returnURL)
I am having an endless problem with the following.When a user logs in I want him directed to a spesific page an not the ReturnURL. How do I enforce this?I am coding in C#
I'm using ASP.NET Membership and Form Authentication and before redirecting to the returnURL I wanted to validate it. For those unfamiliar with the workflow, basically if you request a page that requires that you are authenticated, you are redirected to a login page. In the URL string you'll see a parameter called returnURL, e.g. [URL]
Whether you use this in a redirect such as Response.Redirect(returnURL) or indirectly through the FormsAuthentication.RedirectFromLoginPage method, it passes without validating returnURL.
FormsAuthentication.RedirectFromLoginPage does have a security check that it is isn't leaving the domain, but that still doesn't stop someone from putting enough random characters to cause an error.
I tried using System.IO.File.Exists(Server.MapPath(returnURL)) but given enough illegal characters it cause Server.MapPath to error.
Note: URLEncoding doesn't work because we are not cleaning a parameter, but the primary URL.
I'm having trouble with the ReturnUrl property using forms authentication. If my URL is [URL], the ReturnURL value in the querystring is ignored and it always sends me to the defaultUrl value default.aspx.
I've got a couple pages in my web app that are used by external applications. They will link to the pages, and pass in various querystring values to allow my app to do the searching and return the results in the page. The problem is, if the user is not yet logged into the web app, they are sent to the login page, and the ReturnURL is truncated to include only the first QueryString value. I lose the rest of the values. So far I haven't figured out a solution to this. Here's a quick example:
The external application links the user to: [URL]
If the user is not logged in they are sent to the login page, and the current URL looks like this:
I am trying to redirect the user to login page with ReturnUrl and with querystring parameters which are already in the url there.But it is getting only first querystring parameter and not others. here is the code:Response.Redirect("~/login.aspx?ReturnUrl="+Request.RawUrl);it is showing correct in login.aspx after redirect but not returning as per querystring parametersI ave also tried other methods e.g.:
i have created a page ate.aspx in a folder ate_secure in default directory http://localhost/. when i try to open ate.aspx, it redirects me to login.aspx, thats ok, but when i fill user name and pass and press login button, it doesn't redirect me to ate.aspx and remains at the login page with no error and all fields blank. everything was working fine till my login page ate.aspx were in the same default directory. but i wanted to use role management so i created a folder ate_secure and put ate.aspx into this folder,
In my app, I use the built-in membership for managing security. If I log into my app using my iPad or iPhone, I see some long string preceding the ReturnUrl. Here's an example of what it looks like: [URL] At that point, I'm at where I wanted to go but I'm logged off. If I try to go to another secure page, I have to log in again. And the cycle starts all over again.
I have a website hosted on IIS7 with the url rewrite module 2.0 installed. It is run by content management that looks at the url and returns a 401 error if the current user does not have permission to view the page. This gets picked up by the asp.net url authorization module which then kicks the page over to the loginUrl page as specified in the web.config (forms authentication).
This works perfectly on my local machine - which is IIS7 and windows7.
If the url is, say, /612/some-string the user gets directed to the login page at /66/login?ReturnUrl=/612/some-string
The url rewriting looks at the first part of the url for the document id. The real url would be this: index.aspx?documentId=612
Unfortunately, when I deployed this to our staging server, the ReturnUrl isn't the rewritten url, it's the original url. This causes all sorts of problems.
The staging server is also IIS7 with the url rewrite module 2.0 installed. It's Windows 2008 server SP2. Both are running asp.net 3.5.
My only guess is that the machine.config orders the default httpModules differently, and the .net forms authentication module is jumping in before the url has been rewritten.
I'll review that soon, but in the meantime has anyone experienced this problem and solved it?
Update
I also tried changing
Response.StatusCode = 401;
to
FormsAuthentication.RedirectToLoginPage();
Which gets me a bit ahead, but still directs the user back to the url that hasn't been rewritten.
I have a loginStatus control, if user click "Login", it will go to the login page, and usually followed by "ReturnUrl": for example:
Before I hit the "Login", the page is:
[URL]
After I click the "Login", the URL is:
[URL]
As you can see the parameter value 1008 is gone. Have searched for a while, one article mentioned:
"ASP.NET's login controls use a ReturnUrl, but don't keep the parameters in this URL".
How can i keep the id number (1008) in the ReturnURL? or have other way to get around this? can I write my own returnURL? say once user clicks the "Login", I create my own return url, myReturnURL=ReturnUrl=/Books/CodeInBooks.aspx?id=1008
With Forms Authentication when the app needs to redirect to sign-in page is there an event or any extensibility point that will let me do additional work to the request before it redirects to the sign-in page?
I would like to send additional information in the query string that could vary such that it wouldn't work to just statically embed that in the link in the loginUrl node in the web.config.
Edit: For clarification, I want to intercept the request prior to being redirected TO the login page.
And prior the user being redirected to http://the/interwebs/login.aspx I would like to be able to pack in query values so the url could end up something like http://the/interwebs/login.aspx?Action=Refresh
Is there a build in library in .NET that can compute secure one-way hash ? I mean a library that implements SHA-2 cryptographic hash function or something similar.
If is there is no SHA-2 implementation some weaker hash funcion would be sufficient. If there are more options I prefer the most secure one.
provide a use example e.g. provide the code that returns one-way hash for string mySampleString.
On an ASP.NET page with a tabstrip, I'm using the hash code in the URL to keep track of what tab I'm on (using the BBQ jQuery plugin). For example:
http://mysite.com/foo/home#tab=budget
Unfortunately, I've just realized that there are a couple of places on the page where I'm using an old-fashioned ASP.NET postback to do stuff, and when the postback is complete, the hash is gone:
http://mysite.com/foo/home
... so I'm whisked away to a different tab. No good.
This is a webforms site (not MVC) using .NET 4.0. As you can see, though, I am using URL routing.
Is there a way to tell ASP.NET to keep the hash in the URL following a postback?