I have an iframe that contains protected ftp address
<iframe id="ftpfrm" src="ftp://ftpserver" </iframe>
But when I display the page, it doesn't ask for ftp user name and password. The frame displays an error page.
I need to know if there's a way to force the iframe to ask for user credentials, or to pass the user credentials to the uframe tag.
thanks.
You could try the following to login the user (which i would not recommend):
<iframe id="ftpfrm" src="ftp://user:password#ftpserver" />
Related
I am trying to achieve auto login with given credentials in the back while users can directly see a logged in web page so that they don't need to type or know the credentials. Is there a way to do this without any credentials show up in the URL from user's side?
If you only have a link to work with, this is not possible.
I have a login.asp page. Whenever the session expires, the user is given a link to the login page to log in. After logging in, users need to go back to the original page from which the link was clicked. How do I get the address of that webpage?
You have to grab the referrer when the user is redirected to the login page. Store that and redirected the user back after the login process.
You could redirect him to
/login.asp?next=url-of-where-the-user-tried-to-go
Once he logs in, redirect him to the parameter next. This is extremely common.
There is a property of the document object called referrer
For example link to your website was clicked from http://example.com, you can use document.referrer to get http://example.com
Ref - https://www.w3schools.com/jsref/prop_doc_referrer.asp
I am in a system which developed by Java EE, the link is inside a jsp page, like in this jsp page i have Visit W3Schools, need to log in to this aspx page in different domain without entering username and password. What should put in the target attribute?
In a different domain, pass username and password as query string and fetch this in the aspx page. In the page_load of aspx page, check the username and password with database and allow user accordingly.
I have this in my HTML email to track if someone views the email in say Outlook.
<img src="http://www.example.com/track.ashx?user=3434" />
but this doesn't seem to work.
Should I change my headers in the .ashx to server image headers? (if there are any?)
Can this work using this method?
I emailed myself with an email, other images displayed properly. There was no log in the database for the handler (the handler logs all requests to the db). Calling the URL to the file in the browser logs to the db, so its working.
What testing have you done? A lot of email clients these days don't download images associated with an email unless the user explicitly requests it or adds the sender to a whitelist. It's possible your HTML and server are all correct, but the client just isn't attempting to go to the URL.
Are the email clients set to display pictures? Many don't by default.
I am trying to manually implement a login system in ASP.NET 3.5. Basically, on load, I would like the site to check and see if user object is active, if not, than I want the login page to appear.
After user has logged in successfully, I would like the user to be able to access the same page he has requested originally.
for example:
user request to: MyPage.aspx - not logged in
login page appears instead of MyPage.aspx
user logs in successfully
MyPage.aspx appears instead of Default.aspx for example
Peering at the System.Net namespace, I see that there is an "HttpWebRequest Class" which has a "HttpWebRequest.AllowAutoRedirect Property" but am unsure how that would get me back from the login page.
NOTE: I know there are automatic authentication systems setup in ASP.NET, but I would like to have manual control over the database.
-- Tomek
What you could do, if you don't want to actually use the built in Forms Authentcation is:
Check if the user is authenticated on each page you want to hide from anonymous users. If they are not authenticated, redirect them to your login page with the URL in the query string.
if(!HttpContext.Current.User.Identity.IsAuthenticated) {
Response.Redirect(~/login.aspx?redirect=this_page.aspx");
}
Then on your login page, after a user logs in. Check the query string to see if there is a redirect parameter.
if(!String.IsNullorEmpty(Request.QueryString["redirect"]) {
string url = ResolveClientURL(redirect);
Response.Redirect(url);
}
Of course this is all built into .NET using Authentication, where you can deny anonymous access to certain directories, and when you do that, .NET will redirect to your login page (which is set in the web.config) and will include a "ReturnURL=blahblah" on your login page.
Just an FYI.
Just save the originally requested url in Session or a hidden field on the login page
After successful login, use Server.Transfer or Response.Redirect to jump to that page.
It looks like another method is described here. It seems that you can use the following object to return from the login page:
FormsAuthentication.RedirectFromLoginPage
Yet, according to the article, the better method is to use what JackM described, but with an overload:
Response.Redirect("~/default.aspx", false);
In doing so, you prevent the Session from ending when the page is redirected.