|
You should allow loading images and styles to unauthorized users, this is a typical prcactice.
By default, ASP.NET will require authorization for all files, including images. Something like:
<location path="Images">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
Thanks! I'll try that.
I don't think it was done that way in 1.1 was it?
|
|
|
|
|
Ohhh, I really don't remember how it was in 1.1
1.1 was soooooo long ago..
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
Ok - I put the following config sections in my Web.config but I'm still getting the same behavior:
<location path="images">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<location path="css">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
I tried: allow users="*" but it didn't work so I figured I'd try: allow users="?" since the images on the Login page will need to be displayed for unauthenticated users.
The structure under my website is ./resources/images/myimage.jpg with a similar structure for the css directory.
.NET wouldn't let me specify a path starting with "." or "/" or ending with "/" so I ended up using the config sections above. However, the images and styles still aren't displaying.
|
|
|
|
|
No, you need "*", not "?". "*" is any user, including anonymous. "?" is anonymous.
If the structure of your site is resources/images/myimage.jpg , you should add
<location path="resources/images">
Also, read about location element:
http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx[^]
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
|
I have problem with uploading image to sql database.. In asp.net form i use this input
<br />
<Input ID="MyFile" Type="File" RunAt="Server" onclick="return MyFile_onclick()" /><br />
On database i have atribute in table defined as image. What do i have to insert now to this table,this atribute(named pics) that i could load image from database and displayed it in page? Do i have to make separate table, where i need to insert image title, image size, image type? I tryed with inserting MyFile.Value into table atribute(type image) but it didn't work!!
In form i have also imagebox. How to display selected image from MyFile in this imagebox?
Thanks
|
|
|
|
|
|
Ok i have looked at article..i understand how it works, but when i used it with asp.net application i didn't get full path of file to use it in stream. I tryed both asp:fileupload and input type="file" with PostedFile.FileName and nothing retrieves full path. Everytime i get error that selected picture wasn't found in C:\\windows\\system32\\filename.
I tryed to saved it there, but then i get error for reading rights..
Any idea how to deal with this.?
|
|
|
|
|
Hi..
I m working on a web application where I have simple structure.
I have root directory and a secure directory.
root directory have pages which all users can request, and secure directory will be accessible to users who are authenticated. ( I dont need roles as i will have only one type of users)..
can you tell me how to proceed for authentication..
thanks,
By:
Hemant Thaker
|
|
|
|
|
There are several different ways to accomplish this; what have you tried so far?
If your users have to log in you should be able to create some logic which tests for that and redirects or allows through as appropriate. How are you managing the users?
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|
|
Hi.. thanks,
I am storing users in database. only username and pwd.
Once user is logged in certain links will appear ( links for secured pages).
so I want , only valid users can request these pages..
I simply want to stop someone directly using Urls in address bar for these secured pages..
thanks,
By:
Hemant Thaker
|
|
|
|
|
One way would be to create an attribute that would test to see if the current user is logged in/valid. If not, then redirect to another page. You would create the attribute and then decorate the page class; see the tutorial or fond one more suitable.
Attributes Tutorial[^]
This is just one way and it may not be the best for you (or anyone, for that matter). Do some more research and see what else you can come up with on your own, try it and then come back when you get really stuck.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|
|
Hi.
I am storing username to a session["userid"] variable, once the user logged in.
How about checking the session value on the page_load of all secured pages.
and if dont find the value redirect to "custom_page"
thanks
By:
Hemant Thaker
|
|
|
|
|
if (Session["userid"] != null)
{
}
else
{
}
Raju.M
|
|
|
|
|
Let an attribute do that for you - that's what they are there for! Read the docs and i should get you started.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|
|
hello,
my name is ankur sharma.
I want to create a fusion chart from xml and want to show in swf format using asp.net.
how to achieve it.
Plz guide me
Thanks
|
|
|
|
|
You need to read following guide for creating xml file
from your data.
Fusion Charts[^]
Give this xml file/string to the fusion chart function to generate
and render the charts. The guide will help you to do so.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
|
hi iam using asp.net with c#
in my application when user login successfully,then in the next page based on the client database i have to display data in a grid view ,
so how to give connection string in asp.net with c#
can you correct my code which helps me
protected void Page_Load(object sender, EventArgs e)
{
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
string strcon = "Data Source=";
strcon += clientIPAddress+";" + "Initial Catalog=POS;Trusted_connection=true";
SqlConnection con = new SqlConnection(strcon);
SqlCommand cmd = new SqlCommand("select * from AllTransactions where BranchKey=" + Convert.ToInt32(Session["BranchKey"]) + "", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "tt");
GridView1.DataSource = ds.Tables["tt"];
GridView1.DataBind();
}
the data is displaying in my system but when client logins it is showing no record, can you correct my code
|
|
|
|
|
I am not able to understand why and how
you need to access client side database.
But for getting client IP
Use this..
Request.ServerVariables("REMOTE_ADDR")
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
|
hi to all,
i have added texbox dynamically which is located at modalpopup i want to do validation for that textbox how can i do that//
plz tell me...
thanks
|
|
|
|
|
|
Hi
How to send sms to any mobile no. by web application in asp.net on click of button and automatically on particular date.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|