顯示具有 IIS 標籤的文章。 顯示所有文章
顯示具有 IIS 標籤的文章。 顯示所有文章

2014年7月13日 星期日

[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed


Hi,

The relevant project has been deployed fine in the server but when it is being called by one other project, I got this. Why?



Server Error in '/App11' Application.

--------------------------------------------------------------------------------





The resource cannot be found.

  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.




 Requested URL: /App11/Detail.aspx





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18044  





I would suspect that you are calling a relative URL, but the web address is different on your deployment server.  In other words, you were using the same web address in development, but they have different addresses in production.



No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");



and I see in IIS, App11 has been deployed properly.





Verify your ports then.  Make sure that they are not blocked by any firewall (server and client).



But other projects deployed in the same way, are working fine there.



Look at the "path" from the requesting page to this page that is apparently invisible to the requesting page.  What is different between this "path" in comparison to your other projects/pages.  This would involve any kind of network interaction, especially
firewalls, between the requesting page and the requested page.



Sorry, I don't see any difference within security of the path of the current project in comparison with other projects.



Hi,


Try setting up a Reverse Proxy using IIS, URL Rewrite and ARR


http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx


Hope it can help you





wmec


No, it is being called like this

Response.Redirect("http://192.168.168.1:81/App11/Detail.aspx");


There are a lot of specific points where this could go wrong. For starters the bindings; if you're using different hostname bindings then that could obviously cause a problem. Have you tried using this same URL from your location to see what happens?


Also important to know; is there anything specific mentioned in the IIS logfiles? Because that could give you a good clue as to a possible cause.



[RESOLVED] Bind Image From Physical path outside web directory to Datalist


Hi ,


I am trying to bind a image which is located outside web directory so clients do not have access to resource file to asp Image in datalist control but images are not displayed as it is located other drive phiscal location  and it is manadatory for  me to
do so please suggest me a solution on this 



please find the aspx page below






If you check out the
Image class
then the main property to look out for would be
ImageURL
. This property can use both relative as well as absolute paths.


I'm not sure because I never tried this myself; but I would imagine that you should be able to point an absolute path to the image you're trying to use.




Create virtual directory in iis to the phiscal location, then use this virtual directory to display the image seems like the files is in your application.

Hi,


Or you could use : http://www.dotnetperls.com/ashx . This way you'll use a link such as
/image.ashx?id=name. The handler will get the image form whatever location you want and will sent it back to the browser.


 


[RESOLVED] Linkbutton string not working when there is & in the company name


in my asp.net+vb web i am  using one linkbutton. by this i used to browse the details of company



PostBackUrl="unitlink.aspx?unit=TATA Motors">Tata Motors



PostBackUrl="unitlink.aspx?unit=L&T">L&T


The first linkbutton woks fine and when i click on thhe second one iit doesn't work i checked a lot it is because there is & inthat company name how can be it solved



You should use UrlEncode and UrlDecode


Those methods should be used any time you're inserting user inputted data into the query string.



Hi,


Try adding this to your web.config if you are using .NET 4.0:


system.web>
requestValidationMode="2.0"
requestPathInvalidCharacters="<,>,*,%,:,&,\"
relaxedUrlToFileSystemMapping="true"
/>
...






...

And please refer the blog


http://www.christophercrooker.com/use-any-characters-you-want-in-your-urls-with-aspnet-4-and-iis


http://www.hanselman.com/blog/ExperimentsInWackinessAllowingPercentsAnglebracketsAndOtherNaughtyThingsInTheASPNETIISRequestURL.aspx


Hope it can help you.


[RESOLVED] configuration file


Hi expert, do I need a configuration file in order for a vb.net page  set up in a virutal directory to run in IIS7?

I read some articles, and some said we don't have to.

So what is the standard configuration file for IIS7? Your advice is greatly appreciated.


Thank you!



Hi,


Here is a quite detail
guide
.Cool


 



hi Jessy,


From what I understand you want to set up in a virutal directory to run in IIS7.


Please read the reference below for more information:


http://forums.iis.net/t/1200935.aspx/1?Web+Configuraiton+file+for+IIS7


http://msdn.microsoft.com/en-us/library/bb763173(v=vs.100).aspx


if it not work, you can post the thread to iis forum
http://forums.iis.net/
. that help you solve the problem btter .


[RESOLVED] How do I get SqlDataSource Control parameters from a FormView Drop Down


I have a drop down in a form


                                DataSourceID="SqlLimiter" DataTextField="ShortName" DataValueField="myID">

I want to get to the selected value as a "control parameter for my SQLDataSource Query.


            SelectCommand="SELECT [myID], [ParentType], [ShortName], [IsActive] FROM [Categories] WHERE (([ParentType] = @ParentType) AND ([IsActive] = @IsActive) AND ([ParentID] = @ParentID) AND ([StoreID] = @StoreID))">







It won't work because it is "contained" within the formview container edit mode


How do I get around this?



I tried following this.


http://geekswithblogs.net/AzamSharp/archive/2006/08/27/89475.aspx


But it didn't work.


        SelectCommand="SELECT [myID], [ParentType], [ShortName], [IsActive] FROM [Categories] WHERE (([ParentType] = @ParentType) AND ([IsActive] = @IsActive) AND ([ParentID] = @ParentID) AND ([StoreID] = @StoreID))">









Simply bind it, SelectedValue = '<%# Bind("ParentId") %>' then in parameter use



oned_gk


Simply bind it, SelectedValue = '<%# Bind("ParentId") %>' then in parameter use


Hello,


I also have a problem of parameter not going through, but I guess the reason is different.


The two controls and their datasources are together, on the development machine it runs quite OK, but on an IIS server it seems the parameter stays empty. Is the syntax different ?


I tried what you say, but I am afraid I did not manage the quotes properly, which gave an error on the page.




The blog was the answer to my problem and referencing the container as parent to the child element. 
FormView2$DepartmentSelected


It wasn't working for some reason right away because of some other minor issue.


It doesn't matter if its in the same piece of code, you can't get to the parameter if it is a "child" or a "contained" object, ie, with gridview, formview without referencing that.  Shouldn't be any different between IIS and development
but practically its Microsoft code so everytime you compile it on a different machine you get different results.  So very common to see a piece of code tested working at one place not to work at all on another place. 



Maybe you need code behind


Protected Sub DepartmentSelected_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DepartmentSelected.SelectedIndexChanged
SqlCatLimiter.SelectParameters("ParentId").DefaultValue = CType(sender, DropDownList).SelectedValue
End Sub

or


    Protected Sub SqlCatLimiter_Selecting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlCatLimiter.Selecting
Dim ddl As DropDownList = CType(FormView1.FindControl("DepartmentSelected"), DropDownList)
If ddl IsNot Nothing Then
SqlCatLimiter.SelectParameters("ParentId").DefaultValue = ddl.SelectedValue
End If
End Sub







oned_gk



SqlCatLimiter.SelectParameters("ParentId").DefaultValue = CType(sender, DropDownList).SelectedValue




You know, I am afraid the DefaultValue is ignored. In fact I put one at design time to show the subcategories of the first category, but the subcategory dropdownlist stays empty. I tried to modify it as you say at the selection of a value in the category
dropdownlist, but that changed nothing.


As soon as I remove the system.data section in the Web.config, it runs jolly good on the development machine, but the server throws an exception on the page, as it does not find the provider for the database. They did not install the MySql Connector Net,
and do not seem willing to do it.


 

   

     

     

   


 



One of the big differences between the development system and propagation to IIS will be the "data".   I bet the database and data are different.  The development system probably had a hefty data set and now on IIS there is no data.  This will create bugs
and problems you didn't see before.  One of those would be default values and "null" situations.



Hello,


I found the answer the day after while reading an example in the MySqlMembershipProvider code from CodeProject.


It is very simple :



  • with SQL Server, in a SQL request code you mark a parameter with the @ character
  • with MySql, in a SQL request code you mark a parameter with the ? character.

And that is it.


My page is now online, and the parameters are very well transmitted from a dropdownlist to the other.



[RESOLVED] Display image as per query string


In my asp.net+vb web with access database there is a page which displays data as per query string and the string is PNO and all data is correctly displayed in gridview and dataview. there is a Image1.ImageUrl  and
i used the following code but it is not working


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim PNO As String
PNO = Request.QueryString("PNO")
Image1.ImageUrl = "C:/wing/Photos/" + PNO + ".jpg"
End Sub





When displaying image in web page, use virtual path instead local path like Image1.ImageUrl = "~/wing/Photos/" + PNO + ".jpg". The wing folder can be physical folder or virtual directory under your application (iis virtual directory).

u cannot use local path of image... it must be a virtual path to the web directory.... for example, if "wing" is a name of the folder where u r application is present then, u can do this


Image1.ImageUrl = Server.MapPath("Photoes") + "/" + PNO + ".jpg"

hope this helps...



in a search page of my web the following code is working fine


Dim PNO1 As String = "11022"
PNO1 = " + inputtxt.Text + "
Image1.ImageUrl = "~/Photos/" + PNO + ".jpg"
'Image1.ImageUrl = "C:/Awing/Photos/" + PNO + ".jpg"
'Image1.ImageUrl = "\\ms16eme/Awing/Photos/" + PNO + ".jpg"
End Sub

but when it goes to a string with a hyperlink from another page


 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim PNO As String
PNO = Request.QueryString("PNO")
Image1.ImageUrl = Server.MapPath("Photos") + "/" + PNO + ".jpg"
End Sub

this is not displaying the image







please suggest a solution 



1. Local physical path is used to save your file to server harddisk


  example : c:\myweb\myfile.jpg, d:\user\me\project\myweb\file.txt


2. URL is deferent with physical path, its used in your browser


  example : http:/domain/myimages/file.jpg


  in asp.net control you can use : ~/myimages.jpg


3. ImageUrl, use No 2 sample


4. Server.Mappath is used to determine local physical path when you want to save the file,


  dont sever.mappath to set ImageUrl



i tried various codes but not able to process


The main problem is the input is a string (eg kc1432) and the imake name is KC1432.jpg all data from tables displays from database but image from folder is not displayed


Dim PNO As String

PNO = Request.QueryString("PNO")

Image1.ImageUrl = "~/images/" + PNO + ".jpg"


end sub



Place "Images" folder under your application, if you want place it to another location after published. Creare virtual directory "images" under the application.

the photos are placed inside the images folder in my web directory still it is not working



i got a code from a forum as under but i am not able to edit as per my requirement as i use query string
PNO and the file name varies as per the pNO changes


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("FileName") IsNot Nothing Then
Try
' Read the file and convert it to Byte Array
Dim filePath As String = "C:\images\"
Dim filename As String = Request.QueryString("FileName")
Dim contenttype As String = "image/" & Path.GetExtension(filename).Replace(".", "")

Dim fs As FileStream = New FileStream(filePath & filename, FileMode.Open, FileAccess.Read)
Dim br As BinaryReader = New BinaryReader(fs)
Dim bytes As Byte() = br.ReadBytes(Convert.ToInt32(fs.Length))
br.Close()
fs.Close()

'Write the file to Reponse
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = contenttype
Response.AddHeader("content-disposition", "attachment;filename=" & filename)
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
Catch

End Try


End If
End Sub


 






sir please help me i am in trouble for this code



I tried a lot for solving this problem in different forum & googled a lot. At last i used a trick to solve it


i am binding a string to a label which is PNO


pnotxt.Text = Request.QueryString("PNO")
Dim PNO As String
PNO1 = " + pnotxt.Text + "
Image1.ImageUrl = "~/photos/" + PNO + ".jpg"
end sub

This is not a correct solution but it solved my problem




[RESOLVED] Display image as per query string


In my asp.net+vb web with access database there is a page which displays data as per query string and the string is PNO and all data is correctly displayed in gridview and dataview. there is a Image1.ImageUrl  and
i used the following code but it is not working


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim PNO As String
PNO = Request.QueryString("PNO")
Image1.ImageUrl = "C:/wing/Photos/" + PNO + ".jpg"
End Sub





When displaying image in web page, use virtual path instead local path like Image1.ImageUrl = "~/wing/Photos/" + PNO + ".jpg". The wing folder can be physical folder or virtual directory under your application (iis virtual directory).

u cannot use local path of image... it must be a virtual path to the web directory.... for example, if "wing" is a name of the folder where u r application is present then, u can do this


Image1.ImageUrl = Server.MapPath("Photoes") + "/" + PNO + ".jpg"

hope this helps...



in a search page of my web the following code is working fine


Dim PNO1 As String = "11022"
PNO1 = " + inputtxt.Text + "
Image1.ImageUrl = "~/Photos/" + PNO + ".jpg"
'Image1.ImageUrl = "C:/Awing/Photos/" + PNO + ".jpg"
'Image1.ImageUrl = "\\ms16eme/Awing/Photos/" + PNO + ".jpg"
End Sub

but when it goes to a string with a hyperlink from another page


 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim PNO As String
PNO = Request.QueryString("PNO")
Image1.ImageUrl = Server.MapPath("Photos") + "/" + PNO + ".jpg"
End Sub

this is not displaying the image







please suggest a solution 



1. Local physical path is used to save your file to server harddisk


  example : c:\myweb\myfile.jpg, d:\user\me\project\myweb\file.txt


2. URL is deferent with physical path, its used in your browser


  example : http:/domain/myimages/file.jpg


  in asp.net control you can use : ~/myimages.jpg


3. ImageUrl, use No 2 sample


4. Server.Mappath is used to determine local physical path when you want to save the file,


  dont sever.mappath to set ImageUrl



i tried various codes but not able to process


The main problem is the input is a string (eg kc1432) and the imake name is KC1432.jpg all data from tables displays from database but image from folder is not displayed


Dim PNO As String

PNO = Request.QueryString("PNO")

Image1.ImageUrl = "~/images/" + PNO + ".jpg"


end sub



Place "Images" folder under your application, if you want place it to another location after published. Creare virtual directory "images" under the application.

the photos are placed inside the images folder in my web directory still it is not working



i got a code from a forum as under but i am not able to edit as per my requirement as i use query string
PNO and the file name varies as per the pNO changes


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("FileName") IsNot Nothing Then
Try
' Read the file and convert it to Byte Array
Dim filePath As String = "C:\images\"
Dim filename As String = Request.QueryString("FileName")
Dim contenttype As String = "image/" & Path.GetExtension(filename).Replace(".", "")

Dim fs As FileStream = New FileStream(filePath & filename, FileMode.Open, FileAccess.Read)
Dim br As BinaryReader = New BinaryReader(fs)
Dim bytes As Byte() = br.ReadBytes(Convert.ToInt32(fs.Length))
br.Close()
fs.Close()

'Write the file to Reponse
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = contenttype
Response.AddHeader("content-disposition", "attachment;filename=" & filename)
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
Catch

End Try


End If
End Sub


 






sir please help me i am in trouble for this code



I tried a lot for solving this problem in different forum & googled a lot. At last i used a trick to solve it


i am binding a string to a label which is PNO


pnotxt.Text = Request.QueryString("PNO")
Dim PNO As String
PNO1 = " + pnotxt.Text + "
Image1.ImageUrl = "~/photos/" + PNO + ".jpg"
end sub

This is not a correct solution but it solved my problem




[RESOLVED] ListView not declared


Using VS 2010 and .net 4.0 framework. I am getting the error below when I open my code-behind page that contains a ListView control. Below the error is the code where it is occurring and the code in the editor shows underlines everywhere that the ListView or
events is referenced. How can I resolve or what else can I give to help resolve this? Thanks. 'lvJobSetupSelections' is not declared. It may be inaccessible due to its protection level. Protected Sub lvJobSetupSelections_ItemCanceling(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.ListViewCancelEventArgs) Handles lvJobSetupSelections.ItemCanceling lvJobSetupSelections.InsertItemPosition = InsertItemPosition.None End Sub

hi dlchase89 ,


From what I understand you come across the issue that 'lvJobSetupSelections' is not declared when you use
ListView Control.


It was becuase you had renamed a copy of the *.aspx file and which still using the newer versions code behind file. The code behind file was looking for “lvJobSetupSelections“ ,but on the older version of the *.aspx file “lvJobSetupSelections“ didn’t exist!


I would suggest you  to exclude the older version of the page from the project and then it appears to run ok .


If you need more assistance ,please let me know.



Actually, I am geting this error on multiple pages, all with a ListView control. This is just a hunch but is it due to something in the web.config file? This website project was upgraded from 3.5 to 4.0 framework using VS 2010.

hi dlchase89,


if you don't want to delete older version page and re-create new .


i would suggest you to try the following link to alter web.config file:


 http://forums.asp.net/t/1925542.aspx/


i hope it helps you.



I decided to publish my web.config file (except for secure items) to see if anyone finds something out of order since I am getting the error on every page that has a ListView. Note this website project was in .net 3.5 and we converted to .net 4.0
key="aspnet:MaxHttpCollectionKeys" value="2000"/>
password=""/> assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>


requestEncoding="utf-8" responseEncoding="utf-8"/> verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> validate="false"/> executionTimeout="45"/>



I think I isolated the problem. I started rebuilding the website from scratch and in the new web.config file it created the following entry inside the section. When
I imported web pages from the old site that have ListViews I did not get the error. However, when I try to run the website from IIS it throws an exception as shown below. I think I am closer but still need some expert guideance. How can I get IIS to work with
the targetFramework="4.0" setting? The website is running under an app pool for .net 4.0 Exception message: The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET
Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the 'targetFramework' attribute from the element of the Web.config file.

hi dlchase89,


From what I understand you want to import the xml data into the Excel file, and mapping it to Excel fields.


I would suggest you to try the follow setting:


Select your website in IIS => Basic Settings => Application Pool => Select
.NET Framework Version4.0
.


Please read the reference below for more information: 


http://stackoverflow.com/questions/15241627/configuration-error-compilation-debug-true-targetframework-4-0-asp-net-mv


 If you need more assistance ,please let me know.



The App Pool is already at 4.0, thanks.

hi dlchase89,


From what i understand that your web.config is right but i don't kown that your last issue.


can you tell me your error message in oder to understand you issue better.



I was getting a "ListView is not declared" error on every page in the application that contained a ListView control. I solved it (for now, but not really sure why) by entering a section into the section of the web.config. I followed
an article about manually configuring your web.config for going from 3.5 to 4.0 and the article indicated removal of this section.

[RESOLVED] WriteXml function


Hello, when testing this function on my PC it's work ok, I wonder if do we need to give some special permission on the IIS before pass this code to production?


ds.TC_CONTRATOSOC.WriteXml("contrato.xml", XmlWriteMode.WriteSchema)



You need to make sure that whatever user this application is running under has write permission to the folder where "contrato.xml" is located.  If you are using Windows authentication, then write permission should be given to the user that is logged in.


http://support.microsoft.com/kb/313075?wa=wsignin1.0


Matt


[RESOLVED] Access to the path &#39;D:\Hosting\11696099\html\images\Photography\templatemo_image_04.jpg&#39; is denied.


I local host file upload process is after uploading my site in admin page while uploading image these Error Occours Anyone can help me 



Did you set the write access for that folder? 



Hi,


This is purely problem with the permissions. You need to give permission to the folder for user IUSER if application hosted in IIS.



Hi nravindran,


You just need to give full permission and it will fix your issue. 



You just need to assign read and write permissions to the image folder. it's file permission issue.



hello


you need to giv permission to user .for that you can refer below


Here are the steps to modify ownership and permissions of folders and files:
1. Right-click the file or folder, click Properties, and then click the Security tab.
2. Click Advanced, and then click the Owner tab.
3. Click Edit, and then do one of the following:
· To change the owner to a user or group that is not listed, click Other users and groups and, in Enter the object name to select (examples), type the name of the user or group, and then click OK.
· To change the owner to a user or group that is listed, in the Change owner to box, click the new owner.
4. If you want to take ownership of the contents of the folder, select the Replace owner on sub containers and objects check box.
5. Click OK, and then click Yes when you receive the following message:
You do not have permission to read the contents of directory folder name. Do you want to replace the directory permissions with permissions granting you Full Control?
All permissions will be replaced if you click Yes.

Note folder name is the name of the folder that you want to take ownership of.
6. Click OK, and then reapply the permissions and security settings that you want for the folder and its contents.
Additional considerations
· An administrator can take ownership of any file on the computer.
· Assigning ownership of a file or a folder might require you to elevate your permissions using User Access Control.






[RESOLVED] Server Error in &#39;/&#39; Application.


In IIS i was running my project in root


- Website1/Login.aspx



But I want to run My project in subfolder like this


- Website1/Wiki/Login.aspx


but when i did this i started getting this error


Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 83: ASP.NET to identify an incoming user.
Line 84: -->
Line 85:
Line 86:
Line 87:


Please help me to fix this issue



Thanks





Hello,


You should set the Wiki folder as applicaion in the IIS - Website settings.


Regards



hi vimalbau,


<forms name="Login" defaultUrl="~/Wiki/login.aspx" loginUrl="~/Wiki/login.aspx"
timeout
="20">forms>


hope this is usefull


 




@aspnethost ... Unable to get you please Tell me step by step  if possible


@anandsrivast .. I tried but not working..


Thanks



It is saying that you have more .cofing files in sub folders other than the root. Check this

link
for more information.


[RESOLVED] how to open a file outside website folder..server.mappath


i want to open a word document file(which is outside the website folder) on a button click ..


for example if it is on D drive and in a folder name
Files
and filename is xys.docx


How can use server.mappath to open this xys.docx





Please help..



You can't use Server.MapPath to resolve paths that lie outside of the web site folder structure. You can use a generic handler (ashx file) to read the contents of the file and write them to the browser. Something like this:


public class MyFileHandler : IHttpHandler

{
public void ProcessRequest(HttpContext context)
{
if (context.User.Identity.IsAuthenticated)
{
context.Response.Buffer = true;
context.Response.Clear();
context.Response.AddHeader("content-disposition", "attachment; filename=" + filename);
context.Response.ContentType = "application/octet-stream";

context.Response.WriteFile(@"D:\Files\xyz.doc");
}
}

public bool IsReusable
{
get
{
return false;
}
}
}







thanks 4 ur reply but how to call this in click event in C#.net



If you're in iis, you can use virtual directory.


Server.MapPath("~/VirtualDirectory/xys.docx")

or


Response.Redirect("~/VirtualDirectory/xys.docx")

In visual studio, use physical folder in the application, after you publish it, then use virtual directory to outside the application folder.



In your click event add 


Response.Redirect("~/MyFileHandler.ashx");






[RESOLVED] System.Data.OleDb.OleDbException: Unspecified error


After restarting IIS, the problem is solved.  However, this error happened frequently now. Could anyone help? Thanks in advance.



Hi,


Please try the solution suggested in the below link


http://support.microsoft.com/kb/825738



Hi Calvinx,


This error mostly belongs to permission error, for this error we have mutiple solutions as per situation




  1. Put the impersonate=false in web.config file.



  2. If you want to put the impersonate = true in that case you need to provide the read/write permission to impersonate user on "C:\Documents and Settings\server name\ASPNET" folder or through process monitor utility you can check which file don't have sufficient
    permission.



  3. If you have windows server 2008 then you will not found the ASPNET folder and still want impersonate=true then you need to change the configuration in IIS 7.5/7.0.



Go to IIS -> select your application pool -> Advanced Setting -> Process Model ->Identity=ApplicationPoolIdentity


Go to IIS -> select your application pool -> Advanced Setting -> Load User Profile = False


See here for more details.


or else refer:


http://forums.asp.net/t/1877790.aspx


Hope this helps.


Thanks,


Jatin


[RESOLVED] Automatically direct the site


Hi,

For instance, I start the web site like

http://mycomp.com:81/Start



where Start is one starting project. How to make it automatically direct that to



http://mycomp.com:81/Start



once the user has located to



http://mycomp.com



?





Hi wmec,


i think you can use, Response.Redirect() method in your detault page, that can direct you to your resired location, for example,


// in default.aspx
void Page_Load()
{
Response.Redirect("~/Start/yourPage.aspx");
}

Thanks,



Hi,


You can make the default page setting in IIS level.


there might be other ways to do thi. You can check this post http://forums.asp.net/t/1196778.aspx?Cannot+get+default+page+with+navigating+to+URL+



If your server is running IIS7, you should be able to set the start page for your site in your web.config file




















hi ,


 


if you want to be redirected to the http://mycomp.com:81/Start , and keep the
http://mycomp.com  you can either use the response.redirect in your aspx.c# page and ifyou want to keep the address as it is and still being redirected , you can use the server.transfer ( as long as you are still in the same
domain)


 


one more thing you can also use javascript as well to do it :



or even in the html :



 


 


 



I suspect your actual question is how do you get your website running on the default port.  For your site to be accessable via
http://mycomp.com then it has to be running on port 80, if it isn't you can't access it via that url.  However to answer your question, put this in your global.asax file


protected void Session_Start(object sender, EventArgs e)
{
int port = Request.Url.Port;
if (port != 80)
{
string url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Host, Request.Url.AbsolutePath);
Response.Redirect(url, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
}





Ramesh Ram



If your server is running IIS7, you should be able to set the start page for your site in your web.config file




















Thanks all.


Ramesh,


Yes, I am using IIS 7.5.


Do you mean to put the above into Web.config file of the startup project? Then how does the server know this, when the user has selected this to go?


http://mycomp.com



If you put my above code way in your webconfig , The default document page is load  whenever your application load first time. 





wmec



Ramesh Ram

If your server is running IIS7, you should be able to set the start page for your site in your web.config file



















Thanks all.


Ramesh,


Yes, I am using IIS 7.5.


Do you mean to put the above into Web.config file of the startup project? Then how does the server know this, when the user has selected this to go?





did you deploy the webconfig file in server ? if yes , then the server was automatically load this page  in first time by whenever run your application  . and anywhere we can load the page at second , third etc time .



Thanks.


The startup project has one Web.config file inside. Are you talking about the other Web.config file in the server? Do you know the relevant place of that?





wmec



Thanks.


The startup project has one Web.config file inside. Are you talking about the other Web.config file in the server? Do you know the relevant place of that?





I don't think people have completely grasped your problem.  Changing the default document is not going to help you.  Implement my code in the global.asax file.


Edit: Didn't realise you want the re-direction to work the other way


protected void Session_Start(object sender, EventArgs e)
{
int port = Request.Url.Port;
if (port == 80)
{
string url = string.Format("{0}://{1}:81{2}", Request.Url.Scheme, Request.Url.Host, Request.Url.AbsolutePath);
Response.Redirect(url, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
}

However my point still stands, I don't think this is going to answer your actual problem.  If your site isn't running on port 80 then you can't kick any code off to influence what happens when someone directs to your site.  Sites run on specific ports, not
on servers, and mycomp.com is simply shorthand for mycomp.com:80 and if your site is on mycomp.com:81 then accessing mycomp,.com isn't going to hit your code.



Many thanks Aidy.


Do you think I have to change the port from 81 to 80, and then after applying your codes in Global.asax, it should work?



If your site running on both ports, then yes it would work.  Or else whatever *is* running on port 80 should have the code added to its global.asax


[RESOLVED] FormView/Gridview question


Hi there,



I have a form that consist of gridview which enable Select and Formview initially in Insert mode. When the user select a row clicking the Select on the gridview I change the Formview mode to Edit showing the correct record, most of the time it works like
a charm but sometimes when I click the Formview Update I get 500 Server Internal Error,


I built a test page with only Formview in Edit mode showing one of the records and I Update it constantly and it works great, no error at all.



Any idea why I get this 500 Internal server error ?



there can be lots of reason for this.To view actual error you need to change config file as explained by Aristos


First you need to enable and see detailed errors of your web messages because this is a general message with out giving information's on whats really happening for security reasons.



With the detailed error you can locate the real issue here.



Also if you can run the browser on the server you get detail on the error because server recognize that you are local and show to you, or if you can read the log of the server using the Event Viewer you also see the detailes of your error.



on iis6









on iis7













Note: You can avoid the Debug=true, you only need to close the custom errors for while, and get the detailed error page.



reference: enabling windows custom error messaging on godaddy help articles.



Also can help how to enable the detailed error messages from iis.


reference:
enabling windows custom error messaging
on godaddy help articles.


Also can help
how to enable the detailed error messages
from iis.